Starting commenting and refactoring of code