Reformatting and cleaning up code (step 2/2)