Added cleanup messages functionality