improved move code with clamping etc
visible condition code convenience