You're right, I had not seen that you're returning the last value of the series only, so your original definition was correct - and the series is not needed at all when you only return its last element.