Some bug fixes, support for external functions, function table generation