Added implementation for dot function.