Adds some smarter timeouts and stuff for determining when to sleep