move all print statments to logging function