<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>WPFVisifire.Charts.dll</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -15,7 +15,8 @@ and NodeDetails&lt;'a&gt; =
     { Left: BiculsterNode&lt;'a&gt;;
       Right: BiculsterNode&lt;'a&gt;;
       Distance: float; }
-      
+// TODO the NameValueParis field seems a bit wrong we only really need a vector here 
+// (but we rely on having the name went outputing the results)
 and BiculsterNode&lt;'a&gt; =
     { NameValueParis: Map&lt;string,float&gt;;
       NodeDetails: BiculsterNodeDetails&lt;'a&gt;; }</diff>
      <filename>clustering/hierclustering.fs</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,7 @@ open System.Windows
 open System.Windows.Data
 open System.Windows.Controls
 
+open Strangelights.DataTools.Extensions
 open Strangelights.DataTools.DataAccess
 open Strangelights.DataTools.DataAccess
 open Strangelights.DataTools.Clustering
@@ -112,11 +113,15 @@ let djia =
       &quot;Walmart&quot;, &quot;WMT&quot;, &quot;Broadline retailers&quot;
       &quot;Walt Disney&quot;, &quot;DIS&quot;, &quot;Broadcasting &amp; entertainment&quot; ]
 
+type StockValueHistory =
+    { StockName: String;
+      DateValues: seq&lt;DateTime * float&gt; }
 
 let getStocks desc =
     let getNamedStockInfo name ticker =
         async { let! res = YahooFinance.getStockInfo progress ticker DateTime.Now (DateTime.Now.AddMonths(-3))
                 return name, res }
+
     let workflows =
         desc |&gt; Seq.map (fun (name, ticker, _) -&gt; getNamedStockInfo name ticker)
     
@@ -130,74 +135,98 @@ let getStocks desc =
     let datePriceMap prices = Seq.map (fun (d, p, _, _, _, _, _) -&gt; (any_to_string d), p) prices |&gt; Map.of_seq
     res
     |&gt; Seq.map (fun (name, prices) -&gt; name, Seq.filter (fun (d, _, _, _, _, _, _) -&gt; Seq.exists (fun d' -&gt; d' = d) dates) prices)
-    |&gt; Seq.map (fun (name, prices) -&gt; { DataName = name; Vector = Seq.map (fun (_, p, _, _, _, _, _) -&gt; p) prices |&gt; Seq.cache })
-    |&gt; Seq.cache,
-    res
-    |&gt; Seq.map (fun (name, prices) -&gt; name, Seq.filter (fun (d, _, _, _, _, _, _) -&gt; Seq.exists (fun d' -&gt; d' = d) dates) prices)
-    |&gt; Seq.map (fun (name, prices) -&gt; { NodeDetails = Leaf name; NameValueParis = datePriceMap prices })
+    |&gt; Seq.map (fun (name, prices) -&gt; { StockName = name; DateValues = Seq.map (fun (d, p, _, _, _, _, _) -&gt; d, p) prices |&gt; Seq.cache })
     |&gt; Seq.cache
 
-let stocks, stocks' = getStocks djia
-
-//let scaleDownRes fofMatrix =
-//    MultiD.scaleDown progress 2 fofMatrix 0.001
+let stocks = getStocks djia
 
-//let res = scaleDownRes stocks
-
-let res' =  Clustering.buildClusterTree progress stocks'
+let initClusterNodes stocks = 
+    let datePriceMap prices = 
+        Seq.map (fun (d, p) -&gt; string d, p) prices 
+        |&gt; Map.of_seq
+    let convertStockHist { StockName = name; DateValues = prices } = 
+        { NodeDetails = Leaf name; NameValueParis = datePriceMap prices }
+    Seq.cmap convertStockHist stocks :&gt; seq&lt;_&gt;
+    
+let clusterTree =  Clustering.buildClusterTree progress (initClusterNodes stocks)
 
-//let viewer = new MutliDScaling2DViewer(res)
-let viewer' = new Dendrogram(res'.NodeDetails)
-//let tab1 = new TabItem(Content = viewer, Header = &quot;Mutli-diminsional scaling&quot;) 
+let viewer' = new Dendrogram(clusterTree.NodeDetails)
 
 let nbl&lt;'a when 'a:(new:unit-&gt;'a) and 'a: struct and 'a :&gt; ValueType&gt; x = new Nullable&lt;'a&gt;(x)
 
-let dataSeries =
+let calcPerformance stocks =
+    let perf points =
+        let _, first = Seq.hd points
+        Seq.map (fun (x, y) -&gt; x, (y / first - 1.) * 100.) points
+    Seq.map (fun ({ DateValues = points } as stock) -&gt; { stock with DateValues = perf points }) stocks
+
+let dataSeries stocks =
     let series name points =
         let dataSeries = new DataSeries(RenderAs = RenderAs.Line, LegendText = name,
                                         LineThickness = nbl 0.5)
-        let first = Seq.hd points
-        Seq.map (fun x -&gt; (x / first - 1.) * 100.) points
-        |&gt; Seq.iter (fun x -&gt; dataSeries.DataPoints.Add(new DataPoint(YValue = x)))
+        points |&gt;
+        Seq.iter (fun (_, y) -&gt; dataSeries.DataPoints.Add(new DataPoint(YValue = y)))
         dataSeries
-    Seq.map (fun { DataName = name; Vector = points } -&gt; series name points) stocks
+    Seq.map (fun { StockName = name; DateValues = points } -&gt; series name points) stocks
     |&gt; Seq.cache
 
-type ChartCheckbox(title) =
+type ChartCheckbox(title, dataSeries: seq&lt;DataSeries&gt;) =
     inherit DockPanel()
+    let dataSeries = List.of_seq dataSeries
+    //do printfn &quot;Seq.length dataSeries: %i&quot; (Seq.length dataSeries)
+
     let chart =
         let chart = new Chart()
         chart.Height &lt;- 500.
         chart.Titles.Add(new Title(Text = title))
         chart
 
-    let listBox =
-        let listBox = new ListBox()
-        stocks |&gt; Seq.iter (fun { DataName = name } -&gt; 
-            let chkbx = new CheckBox(Content = name)
+    let chkBoxes =
+        dataSeries |&gt; List.map (fun serie -&gt; 
+            let chkbx = new CheckBox(Content = serie.LegendText)
             chkbx.Checked.Add(fun _ -&gt;
-                let series = dataSeries |&gt; Seq.find (fun x -&gt; x.LegendText = name)
+                let series = dataSeries |&gt; Seq.find (fun x -&gt; x.LegendText = serie.LegendText)
                 chart.Series.Add(series)
                 chart.InvalidateVisual())
             chkbx.Unchecked.Add(fun _ -&gt;
-                let series = dataSeries |&gt; Seq.find (fun x -&gt; x.LegendText = name)
+                let series = dataSeries |&gt; Seq.find (fun x -&gt; x.LegendText = serie.LegendText)
                 chart.Series.Remove(series) |&gt; ignore
                 chart.InvalidateVisual())
-            listBox.Items.Add(chkbx) |&gt; ignore)
-        new ScrollViewer(Content = listBox)
-
+            chkbx)
+    let listBox =
+        let listBox = new ListBox()
+        chkBoxes |&gt; Seq.iter (fun chkbx -&gt; listBox.Items.Add(chkbx) |&gt; ignore)
+        listBox
+    let selectButton text select =
+        let button = new Button(Content = text)
+        button.Click.Add(fun _ -&gt; 
+            chkBoxes |&gt; Seq.iter (fun chkbx -&gt; 
+                chkbx.IsChecked &lt;- nbl select))
+        button
+    let stackPanel =
+        let buttonsPanel = new StackPanel(Orientation = Orientation.Horizontal)
+        buttonsPanel.Children.Add(selectButton &quot;Select All&quot; true) |&gt; ignore
+        buttonsPanel.Children.Add(selectButton &quot;Unselect All&quot; false) |&gt; ignore
+        let stackPanel = new StackPanel()
+        stackPanel.Children.Add(buttonsPanel) |&gt; ignore
+        stackPanel.Children.Add(listBox) |&gt; ignore
+        new ScrollViewer(Content = stackPanel)
     do DockPanel.SetDock(chart, Dock.Top)
     do base.Children.Add(chart) |&gt; ignore
-    do DockPanel.SetDock(listBox, Dock.Bottom)
-    do base.Children.Add(listBox) |&gt; ignore
+    do DockPanel.SetDock(stackPanel, Dock.Bottom)
+    do base.Children.Add(stackPanel) |&gt; ignore
 
-let tab2 = new TabItem(Content = ChartCheckbox(&quot;My chart&quot;), Header = &quot;Charts&quot;) 
+let valuesTab = new TabItem(Content = ChartCheckbox(&quot;Raw Values&quot;, dataSeries stocks), 
+                            Header = &quot;Raw Values Chart&quot;) 
+let perfTab = new TabItem(Content = ChartCheckbox(&quot;Performance&quot;, dataSeries (calcPerformance stocks)), 
+                          Header = &quot;Performance Chart&quot;) 
 let tab3 = new TabItem(Content = viewer', Header = &quot;Dendogram&quot;) 
 
 let tabs = 
     let tabs = new TabControl()
     tabs.Items.Add(tab3) |&gt; ignore
-    tabs.Items.Add(tab2) |&gt; ignore
+    tabs.Items.Add(valuesTab) |&gt; ignore
+    tabs.Items.Add(perfTab) |&gt; ignore
     tabs
 
 let window = new Window(Content = tabs)</diff>
      <filename>examples/stocks.fs</filename>
    </modified>
    <modified>
      <diff>@@ -66,4 +66,11 @@
 	&lt;Target Name=&quot;AfterBuild&quot;&gt;
 	&lt;/Target&gt;
 	--&gt;
+  &lt;PropertyGroup&gt;
+    &lt;PreBuildEvent&gt;
+    &lt;/PreBuildEvent&gt;
+  &lt;/PropertyGroup&gt;
+  &lt;PropertyGroup&gt;
+    &lt;PostBuildEvent&gt;copy &quot;$(ProjectDir)twits.jpg&quot; &quot;$(TargetDir)&quot;&lt;/PostBuildEvent&gt;
+  &lt;/PropertyGroup&gt;
 &lt;/Project&gt;
\ No newline at end of file</diff>
      <filename>examples/twitter.fsproj</filename>
    </modified>
    <modified>
      <diff>@@ -21,19 +21,148 @@
 #endif
 
 open System
+open System.Collections
+open System.IO
+open System.ComponentModel
 open System.Windows
+open System.Windows.Threading
+open System.Windows.Controls
+open System.Windows.Media.Imaging
 
 open Strangelights.DataTools
+open Strangelights.DataTools.DataAccess
 open Strangelights.DataTools.UI
 open Strangelights.DataTools.Extensions
 open Strangelights.DataTools.Clustering
 open Strangelights.DataTools.Treatment
 
-let fofMatrix = Twitter.getFof &quot;robertpi&quot;
+//let fofMatrix = Twitter.getFof &quot;robertpi&quot;
 
-let viewer = new MutliDScaling2DViewer(Twitter.scaleDownRes fofMatrix)
 
-let window = new Window(Content = viewer)
+//let defaultImage =
+//    let decoder = BitmapDecoder.Create(new Uri(@&quot;file:///C:\code\fscollintelli\examples\twits.jpg&quot;), BitmapCreateOptions.None, BitmapCacheOption.Default)
+//    decoder.Frames.[0]
+
+type InvokeThing = delegate of unit -&gt; unit
+
+let addChildren (panel: Panel) children =
+    Seq.iter (fun x -&gt; panel.Children.Add(x) |&gt; ignore) children
+let dc x = x :&gt; FrameworkElement    
+
+
+let statusBar = new TextBox(Text = &quot;Status: doing nothing&quot;, IsReadOnly = true, Width = Double.NaN)
+let updateStatus text =
+    let update =
+        new InvokeThing(fun _ -&gt; statusBar.Text &lt;- text)
+    statusBar.Dispatcher.Invoke(DispatcherPriority.Normal, update) |&gt; ignore
+    
+type FriendViewer(twit: Tweeter) as x =
+    inherit StackPanel()
+    do updateStatus (sprintf &quot;Creating friend: %s&quot; twit.ScreenName)
+    let image = new Image(Width = 100., Height = 100.)
+    let finishedTrigger, finished = Event.create()
+    let finishImage progress (stream: Stream) =
+        let updateDelegate =
+            new InvokeThing(fun _ -&gt; 
+                let decoder = BitmapDecoder.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.Default)
+                image.Source &lt;- decoder.Frames.[0]
+                progress (sprintf &quot;Finshed: %s&quot; twit.ScreenName)
+                finishedTrigger decoder.Frames.[0])
+        image.Dispatcher.Invoke(DispatcherPriority.Normal, updateDelegate) |&gt; ignore
+    let imageWF = HttpXml.getContents updateStatus twit.PictureUrl finishImage ()
+    let checkBox = new CheckBox(Content = twit.ScreenName)
+    do addChildren x [ dc checkBox;  dc image; ]
+    do Async.Spawn(imageWF)
+    member x.FinishedImage = finished
+    member x.IsSelected
+        with get() = if not checkBox.IsChecked.HasValue then false else checkBox.IsChecked.Value
+        and set x = checkBox.IsChecked &lt;- Nullable x
+    member x.Tweeter = twit
+        
+
+
+
+let listView = new ListView(Width = 200.)
+let iterAllItems func =
+    for item in (listView.Items :&gt; IEnumerable) do
+        match item with
+        | :? FriendViewer as fv -&gt; func fv
+        | _ -&gt; ()
+
+let getAllItems () =
+    seq { for item in (listView.Items :&gt; IEnumerable) do
+            match item with
+            | :? FriendViewer as fv -&gt; yield fv
+            | _ -&gt; () }
+
+
+let listPanel =
+    let buttonPanel = new StackPanel(Orientation = Orientation.Horizontal)
+    let selectAll = new Button(Content = &quot;Select All&quot;, Width = 100.)
+    selectAll.Click.Add(fun _ -&gt; iterAllItems (fun fv -&gt; fv.IsSelected &lt;- true))
+    let deselectAll = new Button(Content = &quot;Deselect All&quot;, Width = 100.)
+    deselectAll.Click.Add(fun _ -&gt; iterAllItems (fun fv -&gt; fv.IsSelected &lt;- false))
+    addChildren buttonPanel [ dc selectAll; dc deselectAll ]
+
+    let topPanel = new DockPanel()
+    DockPanel.SetDock(buttonPanel, Dock.Top)
+    addChildren topPanel [ dc buttonPanel; dc listView ]
+    topPanel
+
+let mainPanel = new Border()
+
+let topControls = 
+    let screenName = new TextBox(Text = &quot;robertpi&quot;, Width = 400.)
+    let getFriends = new Button(Content = &quot;Get Friends&quot;, Width = 100.)
+    let draw = new Button(Content = &quot;Draw Friends Map&quot;, Width = 100.)
+    getFriends.Click.Add(fun _ -&gt;
+        let bckWrk = new BackgroundWorker()
+        let username =  screenName.Text
+        updateStatus (sprintf &quot;Getting things for: %s&quot; username)
+        bckWrk.DoWork.Add(fun ea -&gt;
+            let friends = Twitter.getAllFriends updateStatus username
+            ea.Result &lt;- friends)
+        bckWrk.RunWorkerCompleted.Add(fun ea -&gt;
+            updateStatus (sprintf &quot;Finished getting things for: %s&quot; username)
+            let friends =  ea.Result :?&gt; list&lt;Tweeter&gt;
+            let fvs = List.map (fun x -&gt; new FriendViewer(x)) friends
+            Seq.iter (fun x -&gt; listView.Items.Add(x) |&gt; ignore) fvs
+            fvs |&gt; Seq.iter (fun x -&gt; x.FinishedImage.Add(fun _ -&gt; listView.InvalidateVisual())))
+        bckWrk.RunWorkerAsync())
+    draw.Click.Add(fun _ -&gt;
+        let bckWrk = new BackgroundWorker()
+        let friends = 
+            getAllItems ()
+            |&gt; Seq.filter (fun twit -&gt; twit.IsSelected)
+            |&gt; Seq.map (fun twit -&gt; twit.Tweeter.ScreenName)
+            |&gt; Seq.to_list 
+// TODO fix this bit need to know how one should render results of thingy
+//        bckWrk.DoWork.Add(fun ea -&gt;
+//            updateStatus (sprintf &quot;Get matrix for: %A&quot; friends)
+//            let fofMatrix = Twitter.getFofMatrixFromList friends
+//            ea.Result &lt;- MultiD.scaleDown updateStatus 2 fofMatrix 0.01)
+//        bckWrk.RunWorkerCompleted.Add(fun ea -&gt;
+//            updateStatus &quot;Finished grouping friends&quot;
+//            let res =  ea.Result :?&gt; list&lt;MultiDResult&gt;
+//            let mdres = new MutliDScaling2DViewer(res)
+//            printfn &quot;%A&quot; mdres
+//            mainPanel.Child &lt;- mdres)
+        bckWrk.RunWorkerAsync())
+    let sp = new StackPanel(Orientation = Orientation.Horizontal)
+    addChildren sp [ dc screenName; dc getFriends; dc draw ]
+    sp
+
+let mainDock = 
+    DockPanel.SetDock(statusBar, Dock.Bottom)
+    DockPanel.SetDock(topControls, Dock.Top)
+    DockPanel.SetDock(listPanel, Dock.Left)
+    let dp = new DockPanel()
+    addChildren dp [ dc statusBar; dc topControls; 
+                     dc listPanel; dc mainPanel ]
+    dp
+
+let window = new Window(Title = &quot;Robert Pickering's \&quot;the twits\&quot;&quot;, 
+                        Content = mainDock)
 
 let app = new Application()
 </diff>
      <filename>examples/twitterFrontEnd.fs</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ open System.Windows
 open System.Windows.Media
 open Strangelights.DataTools.Clustering
 
-type Dendrogram(t) =
+type Dendrogram(t) as x =
     inherit FrameworkElement()
     let rec getHeight t =
         match t with
@@ -29,15 +29,13 @@ type Dendrogram(t) =
         getDepthInner t 0.0
     let pen = new Pen(Brushes.Black, 1.0)
     let height = getHeight t * 20.
-    let width = 600.
     let depth = getDepth t
     
-    let scaling = width - 150. / depth 
-    
     do base.Height &lt;- height
     //do base.Width &lt;- width
 
     override x.OnRender(dc: DrawingContext) =
+        let scaling = x.ActualWidth / depth 
         
         let rec drawNode t x y =
             match t with
@@ -51,6 +49,11 @@ type Dendrogram(t) =
                 dc.DrawLine(pen, new Point(x, top + h1 / 2.), new Point(x, bottom - h2 / 2.))
 
                 // horizontal line
+//                let text = new FormattedText(string t.Distance, CultureInfo.GetCultureInfo(&quot;en-us&quot;),
+//                                             FlowDirection.LeftToRight,
+//                                             new Typeface(&quot;Verdana&quot;),
+//                                             10., Brushes.Black)
+//                dc.DrawText(text, new Point(x + 5., y - 7.))
                 dc.DrawLine(pen, new Point(x, top + h1 / 2.), new Point(x + ll, top + h1 / 2.))
                 
                 dc.DrawLine(pen, new Point(x, bottom - h2 / 2.), new Point(x + ll, bottom - h2 / 2.))</diff>
      <filename>presentation/dendrogram.fs</filename>
    </modified>
    <modified>
      <diff>@@ -85,6 +85,7 @@ module BlogTreatment =
                         &quot;&amp;lt;&quot;, &quot;&quot;;
                         &quot;&amp;gt;&quot;, &quot;&quot;;
                         &quot;&amp;pound;&quot;, &quot;&#163;&quot; ]
+    // TODO where should this go? is there a better choice of words
     let ignoreList = [  &quot;nbsp&quot;
                         &quot;the&quot;
                         &quot;to&quot;
@@ -236,7 +237,7 @@ module BlogTreatment =
         receiver.Fetch()
 
 
-
+    // TODO using the ignoreList seems to give better results than upperBound so maybe it should be removed?
     /// turn word count list into a hierarical cluster
     let clusterWordCounts progress lowerBound upperBound masterList blogs =
         // remove words that are uncommon or too common
@@ -245,7 +246,7 @@ module BlogTreatment =
             wordCount |&gt; Map.filter (fun word wc -&gt; 
                 let frac = wc / count
                 //printfn &quot;%s: %i / %i = %f&quot; word wc count frac
-                lowerBound &lt; frac &amp;&amp; not (List.mem word ignoreList))
+                lowerBound &lt; frac &amp;&amp; not (List.mem word ignoreList)) // &amp;&amp; frac &lt; upperBound)
 
         // build a master word list containing all the words we interested in
         let masterWordList =</diff>
      <filename>treatment/blogs.fs</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@
 // This source is subject to the GLPv2, please see Strangelights.DataTools.gpl-2.0.txt.
 // Contact Robert Pickering via: http://strangelights.com/
 
-module Strangelights.DataTools.Treatment.Twitter
+namespace Strangelights.DataTools.Treatment
 #if INTERACTIVE
 #I @&quot;C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5&quot;
 #r &quot;System.Threading&quot;
@@ -26,8 +26,7 @@ open System.Xml.XPath
 open System.Globalization
 open Strangelights.DataTools.DataAccess
 open Strangelights.DataTools.Clustering
-
-let progress = printfn &quot;%s&quot;
+open Strangelights.DataTools.Optimization
 
 type Tweeter =
     { Id: int;
@@ -35,13 +34,14 @@ type Tweeter =
       ScreenName: string;
       PictureUrl: string; } 
 
-let treatTweeter name progress (stream: Stream) =
-    progress (Printf.sprintf &quot;Getting: %s&quot; name)
-    let xdoc = new XPathDocument(stream)
-    let nav = xdoc.CreateNavigator()
-    let xpath = nav.Compile(&quot;users/user&quot;)
-    let iter = nav.Select(xpath)
-    let items =
+module Twitter =
+    let progress = printfn &quot;%s&quot;
+
+    let treatTweeter progress (stream: Stream) =
+        let xdoc = new XPathDocument(stream)
+        let nav = xdoc.CreateNavigator()
+        let xpath = nav.Compile(&quot;users/user&quot;)
+        let iter = nav.Select(xpath)
         [ for x in iter -&gt; 
             let x  = x :?&gt; XPathNavigator
             let getValue (nodename: string) =
@@ -51,27 +51,50 @@ let treatTweeter name progress (stream: Stream) =
               Name = getValue &quot;name&quot;;
               ScreenName = getValue &quot;screen_name&quot;;
               PictureUrl = getValue &quot;profile_image_url&quot;; } ]
-    name, items
-//    ((items
-//    |&gt; Seq.take (min (List.length items) 20)
-//    |&gt; Seq.cache) :&gt; seq&lt;_&gt;)
 
-let friendsUrl = Printf.sprintf &quot;http://twitter.com/statuses/friends/%s.xml&quot;
+    let getFriendsCount progress (stream: Stream) =
+        let xdoc = new XPathDocument(stream)
+        let nav = xdoc.CreateNavigator()
+        let iter = nav.Select(&quot;user/friends_count&quot;)
+        let items =
+            [ for x in iter do
+                yield x.ToString() ]
+        match items with
+        | [ followers ] -&gt; Int32.Parse followers
+        | _ -&gt; failwith &quot;assert false&quot;
 
-let getAllFriendsOfFriends name = 
-    let url = friendsUrl name
-    let name, friends = Async.Run (HttpXml.getContents progress url (treatTweeter name) (&quot;&quot;, []))
-    let friendsScreenName = Seq.map (fun { ScreenName = sn } -&gt; sn) friends
-    let friendsOfFriendsWorkflows = Seq.map (fun sn -&gt; HttpXml.getContents progress (friendsUrl sn) (treatTweeter sn) (&quot;&quot;, [])) friendsScreenName
-    friendsScreenName, Async.Run (Async.Parallel friendsOfFriendsWorkflows)
-    
+    let treatIds id progress (stream: Stream) =
+        let xdoc = new XPathDocument(stream)
+        let nav = xdoc.CreateNavigator()
+        let xpath = nav.Compile(&quot;ids/id&quot;)
+        let iter = nav.Select(xpath)
+        let items =
+            [ for x in iter do
+                yield Int32.Parse(x.ToString()) ]
+        id, items
 
-let getFof firstScreenName = 
-    let friendsScreenName, fof = getAllFriendsOfFriends firstScreenName
-    Seq.map (fun (name, friends) -&gt; name, Seq.map (fun fsn  -&gt; if Seq.exists (fun { ScreenName = sn }-&gt; fsn = sn) friends then 2. else 1.) friendsScreenName) fof
-    |&gt; Seq.map (fun (name, fvect) -&gt; { DataName = name; Vector = fvect })
-
-//Seq.length fofMatrix
+    let friendsUrl = sprintf &quot;http://twitter.com/statuses/friends/%s.xml?page=%i&quot;
+    let showUserUrl = sprintf &quot;http://twitter.com/users/show/%s.xml&quot;
+    let friendsIdUrl = sprintf &quot;http://twitter.com/friends/ids.xml?user_id=%i&quot;
+    
+    let getAllFriends progress name =
+        let count = Async.Run (HttpXml.getContents progress (showUserUrl name) getFriendsCount 0) 
+        printfn &quot;count: %i&quot; count
+        let urls = List.map (friendsUrl name) [ 0 .. (count / 100) + 1 ] 
+        Async.Run (Async.Parallel (List.map (fun url -&gt; HttpXml.getContents progress url treatTweeter []) urls))
+        |&gt; Seq.to_list |&gt; List.concat
 
-let scaleDownRes fofMatrix =
-    MultiD.scaleDown progress 2 fofMatrix 0.01
+    let getAllFof id (ids: list&lt;int&gt;) = 
+        let friendsOfFriendsWorkflows = Seq.map (fun sn -&gt; HttpXml.getContents progress (friendsIdUrl sn) (treatIds sn) (0, [])) ids
+        let res = Async.Run (Async.Parallel friendsOfFriendsWorkflows)
+        let allIds = (id, ids) :: List.of_array res
+        let rec pairsOfFloats list =
+            match list with
+            | x :: y :: list -&gt; (x,y) :: pairsOfFloats list
+            | [] -&gt; []
+            | _ -&gt; failwith &quot;uneven list&quot;
+        let costFun points =
+            0.
+        let res = annealing [ for _ in 1 .. (Seq.length allIds) do yield 400., 400. ] costFun 
+        pairsOfFloats (List.of_seq res)
+        
\ No newline at end of file</diff>
      <filename>treatment/twitter.fs</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>79b6bafc0fe6ae579e435d425e03c1b3b9405832</id>
    </parent>
  </parents>
  <author>
    <name>unknown</name>
    <email>robert@.(none)</email>
  </author>
  <url>http://github.com/robertpi/fscollintelli/commit/4c3177dc8a1ca61deaa52d874641b12fc2666bfe</url>
  <id>4c3177dc8a1ca61deaa52d874641b12fc2666bfe</id>
  <committed-date>2009-05-10T00:25:59-07:00</committed-date>
  <authored-date>2009-05-10T00:25:59-07:00</authored-date>
  <message>More general improvements</message>
  <tree>85a9bd92b74a37f0f0f53d47611da2c3e648328b</tree>
  <committer>
    <name>unknown</name>
    <email>robert@.(none)</email>
  </committer>
</commit>
