general code cleanup and stylize.