better comments, moved buffer emission after the wait call