code optimizing for index.js.erb