Minor refactor of results.js