Changes to database query
Merged