Added script engine context, moved the type into the context to remove lock bottleneck