Refactor reachable script method and related.