adding Max's timer code