First version

This is the file that just gets the algorithm to work.  Next steps are
to split this out into functions, then into separate js files.