Comment and refactor code throughout project