Got the dot product loop working but I don't understand why