added some documentation for the code