modualizing compare.js