add index for ordering by locations
update code style