Revert "lots of cleanup"

This reverts commit 98c722b6ebc27def84c53e2ba549ef5bc8c2bcc6.