Added state logic