refactoring for switchLastest operator