Complete code refactoring.