Changed the error clustering function to use only tuples; updated tests.