added the ToStructs code