some basic cleanup of main