Moved sh to use malloc