Added templated function compiling (now can specify what type of function is created)