rewrite munging to maintain session information