Refactored compiler code and tests for user interaction