Add function for buffer stack