[IMP] Code refactoring, remove the code lines from 3800 down to 2300