new update with guo jian's solution