Inline wrapper for distance calculation

Thanks, Stack Overflow! :-)