Bugs fixed, works well now.  Needs better tests and split main program from SOM.