Made readWeights function a separate file