added separate thread to update buffer