Preheat oven to 400 and spray a 7x11 dish with nonstick spray. a 9x13 will also work, it will just be thinner.
Slice potatoes thin, about 1/8th inch thick. Layer half of the potatoes on the bottom of the pan, in overlapping layers.
In a sauce pan, turn on medium high heat and add butter. Once melted, add in onion and saute for a few minutes until slightly softened. Add in garlic, thyme, salt, pepper, and cayenne and stir until combined well.
Whisk in milk and arrowroot powder, and bring to low simmer for a few minutes, stirring occasionally. The mixture should begin to thicken. Turn off heat.
Add in 1/3 of the cheddar cheese to the milk and stir to melt.
Pour half of the cheese sauce over the first half of the potatoes and spread out with spoon.
Add the rest of the potatoes on top in a stacked pattern. Pour the rest of the cheese sauce on top of the potatoes, and spread evenly with spoon.
Top with remaining cheese and bake for 40-45 minutes or until golden brown and bubbly.