Initial commit of function support

Passes the compliance tests (except for exprefs which aren't
implemented) but I suspect more tests needs to be added here.
Fix linting issues
Passing compliance tests
Fix linting issues