Rework redirect_url retrieval

Now a helper method that encapsulates the logic in a clearer fashion.