Added state change based on inputs