avoided foreach loop.
redefined some classes as inner ones of SceneManager.