Refactored hero teleport code