Changed redirection to rely on current url rather than a hidden field.