Implemented end() function.