Use index instead of map