more big refactoring...