Added function support

Untested, but should work...