Refactor a bit and reindent chaptersixexample in scala