refactoring begins!