Added cleanup for bad data