add hashbang
make script executable
some better error checking