Don't append the DB name to the user specified source.
Add support for Postgres 9.1 and 9.2.
Pull main code into function and add some TODOs.