Code Cleanup

Minor code cleanup and test refactoring done during code review session.