basic cleanup, still has an ugly long run function