Added output_weights, docs, tests etc