refactor logic compiler