CDB-1862 Better code, deactivable via app_config so tests using dummy layers won't break