full refactoring