Revert "Complete rewrite done"

This reverts commit 53712c87d48e59eaea1757bd9f22e4f8ae29a2fd.