implemented state selector