improved script engine