Speed up stuff

This change modifies calls to .contents() to issue a single sql query instead of a number of sql queries proportional to the number of attributes set on a pool.