added klass.js and refactor