Moved some stuff around again and refactored a few bits. Still not sure about some of the names