Complete rewrite. Fail ATM. WIP.