Refactoring to extract sorting and filtering of results for a particular hinting session from inner scope creation