Improve shell initialization to work better with more than one shell on ...

...the page at a time.

Fixes #83