You can write a separate input handler and pass its state as booleans to the motion function. If you manually start overriding stuff things might break :(.