Refactored interpreter into a class