Simplified dbcreator code. Still needs testing