Added cleanup function, minor doc refactoring