Changed the data model to be much more database dependent