Changed sum(scalar) to scalar since sum() is only defined for array types
Fixed various malformed html sections.
Merge pull request #109 from sjoelund/sumbug

Changed sum(scalar) to scalar since sum() is only defined for array type...
Initialise index to 0 since the algorithm seems to depend on it