Sorting appendix sections correctly

We previously weren't sorting appendix sections correctly - now we do. Testing should have caught this, but we didn't have tests for this. Now we do.