Added buffer variable to prevent message intersecation between threads.
Updated params passed to threads.