make redirect into callable function