Move the logic to a different class to improve abstraction.