added two unit tests for flattening & unflattening.