cleaned new code and fixed integration testcases