In a large pot of salted water, cook the pasta al dente according to the package instructions. Drain, toss with some butter or oil, and set aside.
In a large pot, melt butter and add flour. Mix well and cook for 1 min.
While constantly whisking, gradually add the milk.
Simmer for about 5 mins until the sauce has thickened.
Whisk in the egg, if using. Optional: only add the egg yolk. Beat the egg white stiff and gently fold it.
Season with nutmeg, salt, and black pepper.
Place the pasta in a large baking dish.
Add diced ham and pour the white sauce over the pasta. Distribute evenly.
First, sprinkle the grated cheese, then the breadcrumbs over the dish. Place dollops of butter on top.
Bake in a preheated oven at 400˚F for about 20 mins or until golden-brown.