move remap function in one place