Implemented review comments.
Pull out database name validation check into *one* function as per review comments.