removed all the extraneous print statements and replaced with calls to logging module