Added comments to methods and refactored