Big refactor, changing nearly everything