Correct bad assumptions made when originally writing this algorithm.
Add assertion to block adding duplicate sections.
Merge pull request #4 from jcoleman/fix-ordering-bug

Fix ordering bug