add flow logic