Added some documentation to code