added comments to functions and the file