added 'update' option
added docstrings