This page should really point at the CREATE A USERCALC CUSTOM FUNCTION that has all of this info already.