Thanks for having a look on the code -- I now see where I went wrong.