Revert "Shamelessly steal code and rewrite it"

This reverts commit 47daf021dd9cc99b307152123af3e4387c2f996b.