updated to use psql