added engine pointer to all funciona calls to enable variables and user-defined functions