modularised a bit more the example