Added more documentation to code.