modified linear.js