Updated with code cleanup from code review on July 1