Finalize postgres module. Move on for now -- this needs more work