Refactored as a class