Added final version of shell.c that works nicely