clean up some code and make nice