Refactor to allow defining against multiple pools, added named queries