Added documentation to the code.