Trust me: derive from ScalarFunction as it'll be much easier.