Move part of router to a dataTransform function