Added Flatten method.
Added Flatten tests.