also enforce more consistency in the exit codes and error handling thanks to Jonathan Yong <[email protected]>