Modified pongranker to work on postgresql