added commentaries above functions