cleanup and upgrade