simplify index
use of index to get all datas
improve ruby code