updated script with test cases