code refactor wip