sb2.js implementation