Improve codeflow, avoid using extra var