added dot product calculations in code using pablos function