Added flatten and single test cases