Some improvements to idle handling and closures.