Code refactor/optimization.