code clean-up and update of testcase