"fixes leeroya/Shell#2" Refactor code