- Added a couple of functions from main() of online version of this code.