Fix derps, and further refactoring