updated so to allow the possibility of reweighing