Peel and slice potatoes, then place in a large bowl of cold water to prevent browning. Set aside. Cook and stir onion and butter in a large saucepan over medium heat till onions are tender.
Whisk in flour, salt, and pepper. Cook and stir till hot and bubbly.
Slowly whisk in milk. Stirring constantly, bring to a boil. Boil for at least one minute. Add cheese and stir till melted.
Drain the water off of the potatoes, then pour the sauce over the top. Stir till well coated, then pour into a large casserole dish that has been sprayed with non-cooking spray.
Cover with foil and bake at 375° for about 60 minutes. Remove foil and cook for an additional 15-20 minutes or till potatoes are tender and top is browned.