removing extraneous space and cleaning up code