Beginnings of a huge refactor