Lock added for adding & removing elements from buffer