Update line intersection code to match what's on the blog