Added set position function and associated tests