Inline move_direction for a big performance boost