[LIR] General refactoring to simplify code and the ease future code review