code test class and modified some function