add documentation for the end() method