adding CSP algorithm