Return dbh if exists
Janitorial work on the code. Fixing some logic and using more Go-idioms.