Updated query logic
Merge pull request #4 from radicalsauce/master

Updated query logic