Refactored interpreter to use the subtree method

Signed off by: Diego Araujo <diegoamc90@gmail.com>