WIP... hefty rewrite