Improve db/cfg creation