Further refactoring during code reviews by product leads.

Removed mistakenly added comment.

Added error logging before throwing exceptions.