refactored and updated compiler