Minor code refactoring.

Made necessary code refactoring changes after code review.