use a switch and cleanup