Some cleanup in shells.py