Changed Test code with better solution