removed a bunch of unused, sub-optimal code