Big refactoring.