Added and changed some methods and added some documentation to the code.