Switch list iteration to index-based as it is more efficient on android.