Move metadata.select calls outside of loop that sets checkboxes to remove
unnecessary metadata.select server load