Improve logging and remove printf statement.