Finally added data persistence to store weights.