Refactoring compiler2
Refactored and made some parts easier, starting on flatting parts of the recursion