Adding error class for showing a program exit state
Adding tests and refactoring scanner and cli to DRY it up