add shell.[ch] + some improvements