Reformatted and added comments