Started refactoring.