More shell refactoring