Cleanup shell helpers

I cleaned up the shell helpers a bit. More can probably be done, but I'm not super-familiar with the code so I didn't want to do too much.