refactor get_indexes to ignore None values