full refactor