Improved assign and switch