cell refactored and add some test cases