Updated state initialization function