Renamed some variables and methods and cleaned up code/comments