Move runtime code to its own, self-contained class