Some code to be adapted and tested