Rewrote the sorting algorithm.
Rewrote the commit method using the priority-ordered list.