Second argument for flatten()

related issue #67 
please review this patch.