more clean logic for index