Use referer header if it exists.
Remove previous URL stuff from session. Bad idea.