Optimizations and configuration.

* Merged Sebastiano's optimizations.
* Parametrized visible reads.