Split prevent_caching() method
Split setup_environment()