Dot

Rewritten the dot functions to reduce the number of necessary functions.