restructure sense.js, prototype function