I've fixed the order of operations so it doesn't create the db until it's ready to put stuff into it.