little improvement in the function move