Refactored nearly everything.