Add respond and redirect function