basic cleanup and a few sylistic changes