Changed to make a deepcopy of dictionary
Added test cases