Add sentinel value at the end of sections.
Add return values for error conditions.
Refactor to allow interactive module use, change CLI options.