cleanup and min