names of some functions changed and test cases fixed