internalfunction factory