Add cleanup of output data, statistics & check for duplicates