* calculate origin rather than using it unchecked
* fixed out-of-bounds check in routing
* obsolete comment