Renamed some methods and formatted the code