moved teleportation code to its own file