cleanups and switch stuff