Added expand function for reading compound entities