Reformats and rearranges code