Chapter refactorings

- [x] Remove shelling out in the test suite against the binary
- [x] Make command and arguments mapping cleaner
- [x] Add unit tests
- [x] Move chapter logic out of the main app defintion