Documented some methods and added comments.