fix typo, JSHint suggestions
add comments, split one loop for clarity
Example intel.ref