smarter formatting
added some logging