this makes the regenerate function more similar to its original.
move session handler to module, extend variables bootstrap, use parameters and container.