added more comments to functions