updated dot product function