Updated moveTo function