patterns and states