alignining and cleaning up some code