Avoiding DB hits when DB is empty
set_metadata_reader() sets and returns the reader
Flat is better than nested
Using add_all() instead of add()

Thanks to Marco Milanesi for spotting this.