refactor record.js to use object instead of array