more BIG refactoring