Made some improvments to the makefile and sh scripts