added token autorenewal, and state control