Heat the oil in a wide frying pan over a gentle heat.
Add the onions and fry gently, stirring frequently, until translucent. They should be softened and not browned. Don't rush this stage - it should take about 8-10 minutes.
Add the garlic and cook for a further minute or so to soften.
Tip in the fresh or tinned tomatoes and the tomato puree and stir.
Add salt and freshly ground black pepper, sugar (if using), the bay leaf and thyme.
Bring up to the boil, then reduce the heat and simmer very gently for 20-30 minutes, stirring frequently, until the tomatoes have reduced down to a thick sauce. You may need to add a little water to prevent it from catching.
When the sauce has been simmering for 10-20 minutes, bring a large pot of well-salted water to the boil and cook your pasta according to the packet instructions.
When the pasta is cooked, drain.
When the sauce is cooked, taste for seasoning and add salt and freshly ground black pepper if necessary. (At this stage, the sauce can be cooled and then frozen in containers for several months.)
When you're ready to serve it, tear the mozzarella into chunks and add to the sauce. Tear the basil leaves and add to the sauce, then turn off the heat from under the sauce.
Remove the bay leaf and thyme.
Pour the sauce over the pasta and serve.