Complete refactor