checking state every 5 seconds instead