Cleaned up the psycopg2 connection and some other unused code.