refactor out into a separate class