This replaces 63, implementing some (most?) endpoints in a different manner that allows us to combine searches and also to prepare all our sql statements