Revamped main loop and the handling of Stella as an environment