Refactored compilation code