Made database selection code more robust. Fixed wording.