cleaned up data model and query structure