rejig mapping code