update add more test, rep code implementation