used logging to replace most print statements