updated init.sh with new algorithm