implementing clean up method