Added inner product function