Refactoring the record selector