refactoring
external function support in progress (does not compile)