refactor to a utility class