clean up some logging statements and did some refactoring