final changes for flat data setup

now fully working