Thanks. I think it does the job of explaining how it all works.
On the subject of the sunset thing... It didn't work
It was fine before sunset as the comparison was always returning false. But it still returned false when sunset arrived. I've changed my code so fingers crossed for about 4.00!