major modifications to the cleanup module