Added comments to some functions