Update to javascript and model to reduce code reuse and to simplify object model.