Refactored into a class