added shallow flatten functionality