rearranges code to follow best practices