Preheat oven to 400F.Grease a 9x9 inch baking dish and set aside.In a medium skillet melt butter over medium heat. Add shallot and cook for 3-4 minutes, stirring frequently. Be careful not to burn it. Add garlic and cook for 1 minute.In a small bowl mix together whole wheat flour and 2-3 tbsp chicken stock. Add the mixture to the cooked shallot. Cook for 1-2 minutes, stirring frequently. Add the remaining stock, milk, salt, pepper and thyme. Bring to a boil and cook for 2 more minutes, or until it thickens a little, stirring frequently. Remove from heat.Arrange ½ of the potatoes covering the bottom of the baking dish. Pour ½ of the sauce over them. Sprinkle ½ cup of cheddar cheese. Arrange the remaining potatoes on top. Pour the rest of the sauce. Sprinkle the rest of the cheese.Cover with aluminum foil. Bake for 30 minutes. Remove the foil and bake for 25-30 minutes until bubbly and the potatoes are cooked through. Garnish with some fresh thyme. Serve.