[IMP]improve the code