Mash the potates until smooth with milk, butter, salt and pepper. saute onions until soft. mix the beaten eggs with ham. grease a baking dish. place half potato mixture in bottom. cover with onions and ham. Place other half potatoes on top. dot with a little butter. Cook for 30 minutes in 350 degree oven.