rewrite using knockout.js