Updated printSourcesSet to print a more useful string representation without ampersands for leading selector references in Complex_Selectors. Add some useful debugging output to trim. Commented out some debug output in extendCompoundSelector that is useful, but shouldn't be on by default. You should be able to turn on EXTEND_COMPLEX and EXTEND_COMPOUND debugging levels and get useful output that helps determine which part of the algorithm the bug is in.