added some docs to the code