refactoring beta wip