Move line map out of loop