Added some comments on function