Adding logging, cleanin gup print statements.