added flatten method
added docs comment for flatten