WIP -- refactoring (NOT WORK)