Begin complete rewrite. WIP.