Reformated code, fixed two issues