Add logging. Take care of pep8.