update models, move database queries to models