Added checked to prevent index not found errors