full implementation of NewNotebook.