Rewrite redirect logic to use session variable. Fixes #9 and fixes #11 :)