improved function printing