more refactor WIP