big refactoring begins