Fix function visibility and argument passing