rewrote init.sh to make it more flexible