Refactoring.
Final version.