updating update_weight method and adding grow method