Adding documentation and refactoring code to smaller methods.