Fixed based on mhrivnak's code review.