added cleanup functionality