created control flow logic