Completed initial to do list:refactoring and commenting