Card #96 - added distinct back in, remove sort by group type, required for postgres 9.4b1 TODO: investigate this further, have removed sort by group type