Created a_next_pos to replace next_position