WIP - make everything better

Cleans code, conserves memory, and adds new features.