Tidy up and bit of a rethink in the data layer