Added support for foreign scalar functions.
remove redundant helper file
rearrange the foreign stuff to after the other scalar classes
wibbles
improve 'toList'