Refactor array keys JS and more consistent comments.