refactor results.js