move interpreter code into a class