Added inactivity checking