Refactorized classes of the script executor and script engine manager.
Implemented part of the script preparation and script state context.