Added ability to have a where clause

Only works with strings at the moment
Added ability to query for max value with filter

This should be handy for stateless synching between other systems
Slight change of heart for no matches

Returning 404 is a little evil
Corrected a mistake with shared code

I didn't change the error handling when I factored some code out