optimize and use states