Added documentation to code