complete mapping logic