Rewrite to fix bugs & limitations
Fixup