Renamed some variables. Reformatted some code.