split generic mapping function to enhance readability