Added documetation to the code