added saving of weights (in a different file for now)