Refactored to use a class.