I don't see `ready` declared inside the closure. Is there a reason for it to be global variable?