Add option to return flattened data object 

Related to issue #31 because it moves a utility function into the core library.