first draft of JS model tested and complete