add 'connected' function wrapper to handle functions that require connection nicely
refactor postgres adapter code