Added exception handling on all the lua function calls, also optimized memory usage by deleting internal events as they are processed