initial refactoring.