1. Replaced equality with compareTo.
2. For dependency matrix, don't check previous instructions.