documentation
improved implementation of events and close