Modification to support custum functions