Adding functions to flatten / inflate objects