Refactor all
Update test cases