Updated function description

Added more comments to the function