Update directive to handle single function execution