added new movement code from Twoshanks