Added clear buffer function