better movement algorithm