Moved switch state initialization