Pointers to references for in/out parameters, renamed line parameter to more
descriptive "distance."