refactored to break out to different classes