Added comments on function.