added idle time detection