Rework redirect_url retrieval

Now a helper method that encapsulates the logic in a clearer fashion.
Merge pull request #64 from jippi/better-redirection

Rework redirect_url retrieval