cleaned up makeOrReturnUrl