* Use each_with_index.map instead of map.with_index to preserve Ruby 1.8.7 compatibility.