improved SQRDIFF
small improvements of CCOEFF