update basis.js, refactoring