Ensure valid index in displayed items
wip Add unit tests