Updated buffer handling with mutex and faster response