code cleanup / organized in preparation of model from json
bug fix in updateState, more code cleanup
model from JSON WIP