Added some documentation to the code