comments added and example of use of the function