rewrote the mapping logic