clean up env and theme switch function