Some refactoring.
More refactoring.
Almost done with the refactoring.