added psql cleanup dupes, rank over partition