documentation added and trying to fix minor code issues