Rewrite move function, add ranged version