js object reorganisation