interpreter rewritten in python for stability