changing application code to match new db postgresql structure