Reduce repetition in database queries
Merge pull request #1 from sgrimm/master

Reduce repetition in database queries