Refactoring FLat Model Code
Got the Flat Model working