Can we check the result here instead of `if (from && to)` below? It seems more error-prone.