complete refactor