Add teleport function and refined  most of codes