Reformatted some code for readablity