Refactored to a separate class