Added util function and comments