Added flatten method to NSArray.