1. To prepare the refried beans, drain the beans and put into a large pan with the chilli flakes, onion, garlic and bay leaf. Cover with lots of cold water, bring to the boil and simmer for up to 2 hours until tender. Drain, discarding the bay leaf and reserving the cooking liquor.
2. Heat the butter in a medium frying pan over a medium heat, add the beans and mash to a rough paste with a potato masher. Leave some of the beans whole to give texture. Stir in the Cheddar and cook over a medium heat for 5 minutes, stirring frequently and adding a little of the reserved cooking liquor now and then, until you have a thick, creamy paste. Season to taste with salt, cover and set aside.
3. For the tomato sauce, heat the oil in a frying pan (the pan will need a lid for the next step) over a medium heat and soften the garlic and onion without browning them. Add the chillies and cook for a couple of minutes, then add the chopped tomatoes and simmer until slightly reduced and thickened - you want to end up with a pourable sauce. Season to taste.
4. Turn the hob down to a low heat, make four wells in the sauce and crack an egg into each. Put the lid on the pan and check every minute or so until the eggs are cooked to your liking. This should take between 8-10 minutes.
5. Warm the tortillas according to the packet instructions and serve with a bowl of refried beans and extra tortillas if you like.