Simplify Shell.js and improve error handling.