removed print() based functions and replaced them with a logging function when the code is called from the command line