Thank you for your help. Now I understand why what I did didn't work. The sketch now works as I intended.