Adding batched solver code and weighting function