refractor codes. increase performance.