use index instead of shift because it's the faster