adding logic to better map PG calls