Change shell buffer name
Tidy up source code a bit