Fix logging in browser
Improve accuracy of segment intersection function