Added sh file and fixed a few bugs