cleaned up some code, removed unnecessary bits