More balanced and comprehensive command sorting priorities. Also adds a new test for this.