public int readChanges(DataInputStream din) throws IOException {
        //read and apply the changes
        int count = 0;
        while (true) {
            int operation;
            try {
                operation = din.readInt();
                count++;
            } catch (EOFException e) {
                //end of changesFile reached 
                //no more changes
                break;
            }
            switch (operation) {
                case OPERATION_SET_CRC:
                    serverCrc = din.readUTF();
                    break;
                case OPERATION_ADD_FAV:
                    FavoriteInternal fav = new FavoriteInternal();
                    fav.read(din);
                    if (fav.isPhantom()) {
                        nbrOfPhatoms++;
                    }
                    fav.setPersistanceIndex(favArray.size());
                    favArray.add(fav);
                    break;
                case OPERATION_SET_FAV_STATUS:
                    int index = din.readInt();
                    int status = din.readInt();
                    //TODO add check for index and status
                    FavoriteInternal favI = (FavoriteInternal)favArray.get(index);
                    if ((!favI.isPhantom()) && 
                        (status == FavoriteInternal.STATUS_PHANTOM)) {
                        nbrOfPhatoms++;
                    }
                    favI.setStatus(status);
                    break;
                default:
                    throw new IOException("Favorile list corrupted persistent data");
            }
        }
        return count;
    }