Adding functions to flatten / expand objects