caught possible error
cleanup and documentation.