more refactoring and cleanup - this is stable and working (index2.html), but the interface for updating has not been added yet