made remap01toint more generic