removing some duplicate code
adding option for throwing exceptions in case an element isn't equal in a list (for debugging)