cleaned up some comments and refactoring and such