Improve #relative_from using array size instead of map