added some doc to the code