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.
I'd probably use an assert() here instead