Better layout/template path resolution.
Extracted method for getting database connection parameters.