documentation to function
closing is now using right function