Cleanup

gather useful history:
and
distinct
count distinct
bugfix for sth.
helper methods