Completed test with working expand/flatten