Got wait() to work