diff --git a/grendel/Main.java b/grendel/Main.java
index c736521e9464..41f840d171e1 100644
--- a/grendel/Main.java
+++ b/grendel/Main.java
@@ -23,27 +23,11 @@
 
 package grendel;
 
-import java.io.File;
-
-import java.util.Properties;
-
-import javax.mail.Folder;
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
-import grendel.storage.BerkeleyStore;
-import grendel.storage.MessageExtra;
+import grendel.prefs.base.UIPrefs;
 
 import grendel.ui.MessageDisplayManager;
 import grendel.ui.MultiMessageDisplayManager;
 import grendel.ui.UnifiedMessageDisplayManager;
-import grendel.ui.DialogAuthenticator;
-
-import grendel.util.Constants;
 
 /**
  * This launches the Grendel GUI.
@@ -52,43 +36,14 @@ import grendel.util.Constants;
 public class Main {
   static MessageDisplayManager fManager;
 
-  public static void main(String argv[]) throws MessagingException {
-    Preferences prefs = PreferencesFactory.Get();
-    String pref = prefs.getString("mail.layout", "multi_pane");
-    Properties props = new Properties();
-    File mailDir;
-    // I'm borrowing pretty heavily from jwz's TestFolderViewer here,
-    // I may change this later, then again, I may not... (talisman)
-
-    if (prefs.getString("mail.directory", "") == "") {
-      mailDir = new File(Constants.HOMEDIR, "grndlmail");
-      if (!mailDir.exists()) {
-        if (mailDir.mkdir()) {
-          //success; put the mail directory in the prefs (talisman)
-          prefs.putString("mail.directory", mailDir.getPath());
-        }
-      } else {
-        prefs.putString("mail.directory", mailDir.getPath());
-      }
-    }
-    props.put("mail.directory", prefs.getString("mail.directory", ""));
-    System.out.println(props.get("mail.directory"));
-    
-    Session session = Session.getDefaultInstance(props, new DialogAuthenticator());
-    System.out.println(session);
-    BerkeleyStore store = new BerkeleyStore(session);
-    System.out.println(store);
-    // Folder folder = store.getDefaultFolder().getFolder("Inbox");  
-    Folder folder = store.getDefaultFolder();
-    
-    if (pref.equals("multi_pane")) {
-      fManager = new UnifiedMessageDisplayManager();
-    } else {
+  public static void main(String argv[]) {
+    if (UIPrefs.GetMaster().getDisplayManager().equals("multi")) {
       fManager = new MultiMessageDisplayManager();
+    } else {
+      fManager = new UnifiedMessageDisplayManager();
     }
     MessageDisplayManager.SetDefaultManager(fManager);
-    //  fManager.displayMaster();
-    fManager.displayMaster(folder.getFolder("Inbox"));
+    fManager.displayMaster();
   }
 }
 
diff --git a/grendel/Makefile b/grendel/Makefile
index 0440ddabc03e..a80023d8105c 100644
--- a/grendel/Makefile
+++ b/grendel/Makefile
@@ -26,7 +26,6 @@ SUBDIRS=		\
 	composition	\
 	dnd		\
 	dog		\
-	filters		\
 	mime		\
 	prefs		\
 	search		\
@@ -37,11 +36,14 @@ SUBDIRS=		\
 	widgets		\
 	$(NULL)
 
+# Temporarily removed because FilterMaster is broken (edwin)
+#	filters		\
+
 SRCS=				\
 	Main.java		\
-	TestFolderViewer.java	\
 	$(NULL)
 
+#	TestFolderViewer.java	\
 #	SelfTest.java		\
 
 
diff --git a/grendel/addressbook/AddressBook.java b/grendel/addressbook/AddressBook.java
index 6d3e1f89f3f8..074bba0c1e3e 100644
--- a/grendel/addressbook/AddressBook.java
+++ b/grendel/addressbook/AddressBook.java
@@ -253,7 +253,7 @@ public class AddressBook extends GeneralFrame {
    *
    */
   public AddressBook() {
-    super("Address Book","0");
+    super("Address Book","addressbook");
 
     // Setting the default values to the variables
     mSortAscending = true;
diff --git a/grendel/calypso/util/Preferences.java b/grendel/calypso/util/Preferences.java
index 005425f60993..aca8b6e6b49f 100644
--- a/grendel/calypso/util/Preferences.java
+++ b/grendel/calypso/util/Preferences.java
@@ -15,6 +15,8 @@
  * The Initial Developer of the Original Code is Netscape Communications
  * Corporation.  Portions created by Netscape are Copyright (C) 1997
  * Netscape Communications Corporation.  All Rights Reserved.
+ *
+ * Contributors: Edwin Woudt <edwin@woudt.nl>
  */
 
 package calypso.util;
@@ -26,10 +28,6 @@ import java.util.Properties;
     @see PreferencesFactory */
 
 public interface Preferences {
-  /** Add a table of default values.  You must add defaults for each
-      preference you use. */
-  void addDefaults(Properties defs);
-
   /** Given a name of a preference, return its value as a String.  If it's not
       defined, return the given default. */
   String getString(String prefname, String defaultValue);
diff --git a/grendel/calypso/util/PreferencesBase.java b/grendel/calypso/util/PreferencesBase.java
index 558162a34b6a..417e1d43073e 100644
--- a/grendel/calypso/util/PreferencesBase.java
+++ b/grendel/calypso/util/PreferencesBase.java
@@ -15,6 +15,8 @@
  * The Initial Developer of the Original Code is Netscape Communications
  * Corporation.  Portions created by Netscape are Copyright (C) 1997
  * Netscape Communications Corporation.  All Rights Reserved.
+ *
+ * Contributors: Edwin Woudt <edwin@woudt.nl>
  */
 
 package calypso.util;
@@ -29,48 +31,43 @@ import java.util.Properties;
 import java.util.MissingResourceException;
 import java.util.Enumeration;
 
+import grendel.util.Constants;
+
+/**
+ * Contains the File handling logic of the prefs.
+ */
+
 class PreferencesBase extends Properties implements Preferences {
 
-  static final String gPrefsPath = System.getProperties().getProperty("user.home");
-  static final String gPrefsFile = "xena.pref";
+  static final File gPrefsPath = Constants.HOMEDIR;
+  static final String gPrefsFile = "grendel.pref";
 
   PreferencesBase() {
     super();
 
-    File infile = new File(new File(gPrefsPath), gPrefsFile);
+    // create the dir if it doesn't exist
+    gPrefsPath.mkdirs();
+
+    File infile = new File(gPrefsPath, gPrefsFile);
     InputStream in = null;
     try {
       in = new FileInputStream(infile);
       load(in);
       in.close();
     } catch (IOException e) {
+      e.printStackTrace();
     }
   }
 
   void writePrefs() {
-    File outfile = new File(new File(gPrefsPath), gPrefsFile);
+    File outfile = new File(gPrefsPath, gPrefsFile);
     OutputStream out = null;
     try {
       out = new FileOutputStream(outfile);
-      save(out, "Xena User Preferences.  Do not directly modify this file!");
+      save(out, "Grendel User Preferences.  Do not directly modify this file!");
       out.close();
     } catch (IOException e) {
-    }
-  }
-
-  public void addDefaults(Properties defs) {
-    if(defs == null) {
-      return;
-    }
-
-    if(defaults == null) {
-      defaults = defs;
-      return;
-    }
-
-    for(Enumeration e = defs.keys(); e.hasMoreElements();) {
-      Object key = e.nextElement();
-      defaults.put(key, defs.get(key));
+      e.printStackTrace();
     }
   }
 
diff --git a/grendel/composition/Composition.java b/grendel/composition/Composition.java
index 470ce585610c..b35ab77f2e5c 100644
--- a/grendel/composition/Composition.java
+++ b/grendel/composition/Composition.java
@@ -73,7 +73,7 @@ public class Composition extends GeneralFrame {
      *
      */
     public Composition() {
-        super("Composition", "mail.composition");
+        super("Composition", "composition");
         fResourceBase = "grendel.composition";
         Box mBox = Box.createVerticalBox();
 
diff --git a/grendel/composition/CompositionPanel.java b/grendel/composition/CompositionPanel.java
index 758777ce3e06..0aa0937a5396 100644
--- a/grendel/composition/CompositionPanel.java
+++ b/grendel/composition/CompositionPanel.java
@@ -28,8 +28,6 @@ package grendel.composition;
 
 import calypso.util.ByteBuf;
 import calypso.util.ByteLineBuffer;
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
 
 import java.awt.BorderLayout;
 import java.awt.Container;
@@ -80,6 +78,9 @@ import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeUtility;
 import javax.mail.internet.InternetAddress;
 
+import grendel.prefs.base.GeneralPrefs;
+import grendel.prefs.base.IdentityArray;
+import grendel.prefs.base.IdentityStructure;
 import grendel.storage.MessageExtra;
 import grendel.storage.MessageExtraFactory;
 import grendel.ui.ActionFactory;
@@ -451,126 +452,119 @@ public class CompositionPanel extends GeneralPanel {
 
       //Check that is at least one recipient.
       if (0 < recipients.length) {
-        //get the sending identity
-        Preferences prefs = PreferencesFactory.Get();
-        int ident = mAddressBar.getOptionsPanel().getSelectedIdentity();
-	String userName = 
-	  prefs.getString("mail.identity.username." + ident,
-			  "Nobody") + " <" 	
-	  + prefs.getString("mail.identity.email." + ident,
-			    "nobody@localhost") + ">";
 
-        if (userName != null) {
-          //create a mime message
-          MimeMessage msg = new MimeMessage(mSession); // TD
+        //create a mime message
+        MimeMessage msg = new MimeMessage(mSession); // TD
+
+        try {
+          IdentityStructure ident = IdentityArray.GetMaster().get(
+                            mAddressBar.getOptionsPanel().getSelectedIdentity());
+          
+          //set who's sending this message.
+          msg.setFrom (new InternetAddress(ident.getEMail(), ident.getName()));
+
+          //add the recipients one at a time.
+          for (int i = 0; i < recipients.length; i++) {
+            javax.mail.Address[] toAddress = new InternetAddress[1];
+            toAddress[0] = new InternetAddress(recipients[i].getText());
+
+            Message.RecipientType deliverMode = Message.RecipientType.TO;
+
+            //map grendel.composition.Addressee delivery modes
+            //  into javax.mail.Message delivery modes.
+            switch (recipients[i].getDelivery()) {
+              case Addressee.TO:
+                deliverMode = Message.RecipientType.TO;
+                break;
+              case Addressee.CC:
+                deliverMode = Message.RecipientType.CC;
+                break;
+              case Addressee.BCC:
+                deliverMode = Message.RecipientType.BCC;
+                break;
+            }
+            msg.addRecipients(deliverMode, toAddress);
+          }
+
+          msg.setSubject(mSubject.getText());        //set subject from text
+                                                     //field.
+          msg.setHeader("X-Mailer", "Grendel [development version]");
+                                                     //and proud of it! 
+          msg.setSentDate(new java.util.Date());     //set date to now.
+
+          String [] attachments = mAttachmentsList.getAttachments();
+          if (attachments.length == 0) {
+            msg.setContent(messageText, "text/plain"); //contents.
+          } else {
+            MimeMultipart multi = new MimeMultipart();
+              
+            MimeBodyPart mainText = new MimeBodyPart();
+            mainText.setText(messageText);
+            multi.addBodyPart(mainText);
+
+            for (int i = 0; i < attachments.length; ++i) {
+              try {
+                File f = new File(attachments[i]);
+                int len = (int) f.length();
+                String mimeString =
+                  FileTypeMap.getDefaultFileTypeMap().getContentType(f);
+                MimeType mimeType = new MimeType(mimeString);
+
+                byte [] bs = new byte[len];
+                FileInputStream fis = new FileInputStream(f);
+                DataInputStream dis = new DataInputStream(fis);
+                dis.readFully(bs);
+                dis.close();
+                fis.close();
+
+                MimeBodyPart att = new MimeBodyPart();
+                String encName = "7bit";
+                if (mimeType.getPrimaryType().equalsIgnoreCase("text")) {
+                  if (!isCleanText(bs)) {
+                    encName = "quoted-printable";
+                  }
+                } else {
+                  encName = "base64";
+                }
+
+                att.setText(new String(bs)); 
+                att.setHeader("Content-Type", mimeString);
+                att.setHeader("Content-Transfer-Encoding", encName);
+                att.setFileName(new File(attachments[i]).getName());
+                att.setDisposition("Attachment");
+                multi.addBodyPart(att);
+              } catch (Exception e) {
+                // Could be IOException or MessagingException.  For now...
+                e.printStackTrace();
+              }
+            }
+
+            msg.setContent(multi);
+          }
 
           try {
-            //set who's sending this message.
-            msg.setFrom (new InternetAddress(userName));
-
-            //add the recipients one at a time.
-            for (int i = 0; i < recipients.length; i++) {
-              javax.mail.Address[] toAddress = new InternetAddress[1];
-              toAddress[0] = new InternetAddress(recipients[i].getText());
-
-              Message.RecipientType deliverMode = Message.RecipientType.TO;
-
-              //map grendel.composition.Addressee delivery modes
-              //  into javax.mail.Message delivery modes.
-              switch (recipients[i].getDelivery()) {
-                case Addressee.TO:
-                  deliverMode = Message.RecipientType.TO;
-                  break;
-                case Addressee.CC:
-                  deliverMode = Message.RecipientType.CC;
-                  break;
-                case Addressee.BCC:
-                  deliverMode = Message.RecipientType.BCC;
-                  break;
-              }
-              msg.addRecipients(deliverMode, toAddress);
-            }
-
-            msg.setSubject(mSubject.getText());        //set subject from text
-                                                       //field.
-            msg.setHeader("X-Mailer", "Grendel [development version]");
-                                                       //and proud of it! 
-            msg.setSentDate(new java.util.Date());     //set date to now.
-
-            String [] attachments = mAttachmentsList.getAttachments();
-            if (attachments.length == 0) {
-              msg.setContent(messageText, "text/plain"); //contents.
-            } else {
-              MimeMultipart multi = new MimeMultipart();
-              
-              MimeBodyPart mainText = new MimeBodyPart();
-              mainText.setText(messageText);
-              multi.addBodyPart(mainText);
-
-              for (int i = 0; i < attachments.length; ++i) {
-                try {
-                  File f = new File(attachments[i]);
-                  int len = (int) f.length();
-                  String mimeString =
-                    FileTypeMap.getDefaultFileTypeMap().getContentType(f);
-                  MimeType mimeType = new MimeType(mimeString);
-
-                  byte [] bs = new byte[len];
-                  FileInputStream fis = new FileInputStream(f);
-                  DataInputStream dis = new DataInputStream(fis);
-                  dis.readFully(bs);
-                  dis.close();
-                  fis.close();
-
-                  MimeBodyPart att = new MimeBodyPart();
-                  String encName = "7bit";
-                  if (mimeType.getPrimaryType().equalsIgnoreCase("text")) {
-                    if (!isCleanText(bs)) {
-                      encName = "quoted-printable";
-                    }
-                  } else {
-                    encName = "base64";
-                  }
-
-                  att.setText(new String(bs)); 
-                  att.setHeader("Content-Type", mimeString);
-                  att.setHeader("Content-Transfer-Encoding", encName);
-                  att.setFileName(new File(attachments[i]).getName());
-                  att.setDisposition("Attachment");
-                  multi.addBodyPart(att);
-                } catch (Exception e) {
-                  // Could be IOException or MessagingException.  For now...
-                  e.printStackTrace();
-                }
-              }
-
-              msg.setContent(multi);
-            }
-
-            try {
-              Properties props = mSession.getProperties();
-              props.put("mail.host", prefs.getString("mail.identity.smtphost." + ident, "localhost"));
-              Session newSession = Session.getInstance(props,null);
-              newSession.getTransport("smtp").send(msg);       // send the message.
-            } catch (MessagingException exc) {
-              exc.printStackTrace();
-            }
-                    
-            success = true;
-          } catch (javax.mail.SendFailedException sex) {
-            sex.printStackTrace();
-            Address addr[] = sex.getInvalidAddresses();
-            if (addr != null) {
-              System.err.println("Addresses: ");
-              for (int i = 0; i < addr.length; i++) {
-                System.err.println("  " + addr[i].toString());
-              }
-            }
-          } catch (MessagingException mex) {
-            mex.printStackTrace();
+            Properties props = mSession.getProperties();
+            props.put("mail.host", GeneralPrefs.GetMaster().getSMTPServer());
+            Session newSession = Session.getInstance(props,null);
+            newSession.getTransport("smtp").send(msg);       // send the message.
+          } catch (MessagingException exc) {
+            exc.printStackTrace();
           }
-        }  else {
-          System.err.println("user.email_address undefined");
+                  
+          success = true;
+        } catch (javax.mail.SendFailedException sex) {
+          sex.printStackTrace();
+          Address addr[] = sex.getInvalidAddresses();
+          if (addr != null) {
+            System.err.println("Addresses: ");
+            for (int i = 0; i < addr.length; i++) {
+              System.err.println("  " + addr[i].toString());
+            }
+          }
+        } catch (MessagingException mex) {
+          mex.printStackTrace();
+        } catch (UnsupportedEncodingException uee) {
+          uee.printStackTrace();
         }
       }
 
@@ -772,17 +766,14 @@ public class CompositionPanel extends GeneralPanel {
     }
     public void actionPerformed(ActionEvent event) {
 
-      int ident = mAddressBar.getOptionsPanel().getSelectedIdentity();
-      Preferences prefs = PreferencesFactory.Get();
-      String sigFileName = prefs.getString("mail.identity.signature." + ident, "");
-
       Document doc = mEditor.getDocument();
       int oldPosition = mEditor.getCaretPosition();
       
-      for (int i=0; i<doc.getLength()-3;i++) {
+      //remove the old signature
+      for (int i=0; i<doc.getLength()-4;i++) {
         try {
           if (doc.getText(i,1).equals("\n")) {
-            if (doc.getText(i+1,3).equals("-- ")) {
+            if (doc.getText(i+1,4).equals("-- \n")) {
               doc.remove(i, doc.getLength()-i);
             }
           }
@@ -791,28 +782,23 @@ public class CompositionPanel extends GeneralPanel {
         }
       }
       
+      //the signature will be added at the end
       int position = doc.getEndPosition().getOffset() - 1;
       
-      try {
-        BufferedReader sigReader = new BufferedReader(new FileReader(sigFileName));
+      //compose the string including the separator
+      String s = "\n-- \n";
+      int ident = mAddressBar.getOptionsPanel().getSelectedIdentity();
+      s = s + IdentityArray.GetMaster().get(ident).getSignature();
 
-        String s = "\n-- ";
-        while (s != null) {
-          s = s + "\n";
+      //if a signature was specified, add it now
+      if (s.length()>5) {
+        try {
           doc.insertString(position, s, null);
-          position += s.length();
-      	  s = sigReader.readLine();
+        } catch (BadLocationException ble) {
+          ble.printStackTrace();
         }
-      } catch (FileNotFoundException fnfe) {
-        //this can mean two things: either there's no signature specified
-        //or the file is missing. I the last case we should do
-        //something sensible.
-      } catch (IOException ioe) {
-        ioe.printStackTrace();
-      } catch (BadLocationException ble) {
-        ble.printStackTrace();
       }
-      
+            
       mEditor.setCaretPosition(oldPosition);
       
     }
diff --git a/grendel/composition/OptionsPanel.java b/grendel/composition/OptionsPanel.java
index 91137023bf00..f2466bbf83d7 100644
--- a/grendel/composition/OptionsPanel.java
+++ b/grendel/composition/OptionsPanel.java
@@ -29,9 +29,7 @@ import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.border.*;
 
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
+import grendel.prefs.base.IdentityArray;
 import grendel.ui.ActionFactory;
 
 public class OptionsPanel extends JPanel implements Serializable  {
@@ -94,11 +92,10 @@ public class OptionsPanel extends JPanel implements Serializable  {
 
         ident = new LabeledCombo("Identity");
 
-	// Read all the different identities from the preferences file
-        Preferences prefs = PreferencesFactory.Get();
-        int numIdentities = prefs.getInt("mail.identities", 1);
-        for (int i=0; i<numIdentities; i++) {
-            ident.addPossibleValue(prefs.getString("mail.identity.description."+ i, "(no description available)"));
+        // Read all the different identities from the preferences file
+        IdentityArray ia  = IdentityArray.GetMaster();
+        for (int i=0; i<ia.size(); i++) {
+            ident.addPossibleValue(ia.get(i).getDescription());
         }
         // Select the default identity
         ident.setSelectedIndex(ActionFactory.getIdent());
diff --git a/grendel/prefs/Makefile b/grendel/prefs/Makefile
index df1c62e53347..1a95b9c99b0e 100644
--- a/grendel/prefs/Makefile
+++ b/grendel/prefs/Makefile
@@ -17,6 +17,13 @@
 # Netscape Communications Corporation.  All Rights Reserved.
 #
 # Contributors: Giao Nguyen <grail@cafebabe.org>
+#               Edwin Woudt <edwin@woudt.nl>
+
+SUBDIRS=		\
+	base	\
+	ui \
+	$(NULL)
+
 
 SRCS=					\
 	MailServerPrefs.java		\
diff --git a/grendel/prefs/base/GeneralPrefs.java b/grendel/prefs/base/GeneralPrefs.java
new file mode 100644
index 000000000000..998f26711b3c
--- /dev/null
+++ b/grendel/prefs/base/GeneralPrefs.java
@@ -0,0 +1,64 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+import calypso.util.Preferences;
+import calypso.util.PreferencesFactory;
+
+public class GeneralPrefs {
+
+  private static GeneralPrefs MasterGeneralPrefs;
+  
+  public static synchronized GeneralPrefs GetMaster() {
+    if (MasterGeneralPrefs == null) {
+      MasterGeneralPrefs = new GeneralPrefs();
+    }
+    return MasterGeneralPrefs;
+  }
+
+  Preferences prefs;
+  
+  private GeneralPrefs() {
+    prefs = PreferencesFactory.Get();
+    readPrefs();
+  }
+
+  public void readPrefs() {
+    setSMTPServer(prefs.getString("general.smtpserver",""));
+    writePrefs();
+  }
+  
+  public void writePrefs() {
+    prefs.putString("general.smtpserver",getSMTPServer());
+  }
+  
+  String mySMTPServer;
+  
+  public String getSMTPServer() {
+    return mySMTPServer;
+  }
+  
+  public void setSMTPServer(String aSMTPServer) {
+    mySMTPServer = aSMTPServer;
+  }
+  
+}
diff --git a/grendel/prefs/base/IdentityArray.java b/grendel/prefs/base/IdentityArray.java
new file mode 100644
index 000000000000..14cdff0653f7
--- /dev/null
+++ b/grendel/prefs/base/IdentityArray.java
@@ -0,0 +1,96 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+import java.util.Vector;
+
+import calypso.util.Preferences;
+import calypso.util.PreferencesFactory;
+
+public class IdentityArray {
+
+  private static IdentityArray MasterIdentityArray;
+  
+  public static synchronized IdentityArray GetMaster() {
+    if (MasterIdentityArray == null) {
+      MasterIdentityArray = new IdentityArray();
+    }
+    return MasterIdentityArray;
+  }
+
+  Vector ids = new Vector();
+  Preferences prefs;
+  
+  private IdentityArray() {
+    prefs = PreferencesFactory.Get();
+    readPrefs();
+  }
+  
+  public void readPrefs () {
+
+    for (int i=0; i<prefs.getInt("identity.count",1); i++) {
+      IdentityStructure id = new IdentityStructure();
+      id.setDescription(prefs.getString("identity."+i+".description","Default Identity"));
+      id.setName(prefs.getString("identity."+i+".name","John Doe"));
+      id.setEMail(prefs.getString("identity."+i+".email","nobody@localhost"));
+      id.setReplyTo(prefs.getString("identity."+i+".replyto",""));
+      id.setOrganization(prefs.getString("identity."+i+".organization",""));
+      id.setSignature(prefs.getString("identity."+i+".signature",""));
+      add(id);
+    }
+    writePrefs();
+  }
+  
+  public void writePrefs () {
+    
+    prefs.putInt("identity.count",size());
+    
+    for (int i=0; i<size(); i++) {
+      
+      prefs.putString("identity."+i+".description" ,get(i).getDescription());
+      prefs.putString("identity."+i+".name"        ,get(i).getName());
+      prefs.putString("identity."+i+".email"       ,get(i).getEMail());
+      prefs.putString("identity."+i+".replyto"     ,get(i).getReplyTo());
+      prefs.putString("identity."+i+".organization",get(i).getOrganization());
+      prefs.putString("identity."+i+".signature"   ,get(i).getSignature());
+      
+    }
+    
+  }
+  
+  public IdentityStructure get (int Index) {
+    return (IdentityStructure)ids.elementAt(Index);
+  }
+  
+  public void add (IdentityStructure aIdentity) {
+    ids.add(aIdentity);
+  }
+  
+  public void remove (int Index) {
+    ids.removeElementAt(Index);
+  }
+  
+  public int size () {
+    return ids.size();
+  }
+
+}
\ No newline at end of file
diff --git a/grendel/prefs/base/IdentityStructure.java b/grendel/prefs/base/IdentityStructure.java
new file mode 100644
index 000000000000..8e2932c1c9f6
--- /dev/null
+++ b/grendel/prefs/base/IdentityStructure.java
@@ -0,0 +1,90 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+public class IdentityStructure {
+
+  String myDescription = "";
+  String myName = "";
+  String myEMail = "";
+  String myReplyTo = "";
+  String myOrganization = "";
+  String mySignature = "";
+  
+  public IdentityStructure() {
+  }
+
+  public IdentityStructure(String aDescription) {
+    
+    myDescription = aDescription;
+    
+  }
+  
+  public String getDescription() {
+    return myDescription;
+  }
+
+  public String getName() {
+    return myName;
+  }
+
+  public String getEMail() {
+    return myEMail;
+  }
+
+  public String getReplyTo() {
+    return myReplyTo;
+  }
+
+  public String getOrganization() {
+    return myOrganization;
+  }
+
+  public String getSignature() {
+    return mySignature;
+  }
+  
+  public void setDescription(String aDescription) {
+    myDescription = aDescription;
+  }
+
+  public void setName(String aName) {
+    myName = aName;
+  }
+
+  public void setEMail(String aEMail) {
+    myEMail = aEMail;
+  }
+
+  public void setReplyTo(String aReplyTo) {
+    myReplyTo = aReplyTo;
+  }
+
+  public void setOrganization(String aOrganization) {
+    myOrganization = aOrganization;
+  }
+
+  public void setSignature(String aSignature) {
+    mySignature = aSignature;
+  }
+
+}
\ No newline at end of file
diff --git a/grendel/prefs/base/InvisiblePrefs.java b/grendel/prefs/base/InvisiblePrefs.java
new file mode 100644
index 000000000000..cbacf6c5a4be
--- /dev/null
+++ b/grendel/prefs/base/InvisiblePrefs.java
@@ -0,0 +1,115 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+import calypso.util.Preferences;
+import calypso.util.PreferencesFactory;
+
+import java.awt.Rectangle;
+
+public class InvisiblePrefs {
+
+  private static InvisiblePrefs MasterInvisiblePrefs;
+  
+  public static synchronized InvisiblePrefs GetMaster() {
+    if (MasterInvisiblePrefs == null) {
+      MasterInvisiblePrefs = new InvisiblePrefs();
+    }
+    return MasterInvisiblePrefs;
+  }
+
+  Preferences prefs;
+  
+  private InvisiblePrefs() {
+    prefs = PreferencesFactory.Get();
+    readPrefs();
+  }
+
+  public void readPrefs() {
+    setFolderPanelColumnLayout(prefs.getString ("invisible.column.folderpanel",""));
+    setMasterPanelColumnLayout(prefs.getString ("invisible.column.masterpanel",""));
+    writePrefs();
+  }
+  
+  public void writePrefs() {
+    prefs.putString ("invisible.column.folderpanel",getFolderPanelColumnLayout());
+    prefs.putString ("invisible.column.masterpanel",getMasterPanelColumnLayout());
+  }
+  
+  String myFolderPanelColumnLayout;
+  String myMasterPanelColumnLayout;
+  
+  public String getFolderPanelColumnLayout() {
+    return myFolderPanelColumnLayout;
+  }
+  
+  public String getMasterPanelColumnLayout() {
+    return myMasterPanelColumnLayout;
+  }
+  
+  public void setFolderPanelColumnLayout(String aFolderPanelColumnLayout) {
+    myFolderPanelColumnLayout = aFolderPanelColumnLayout;
+  }
+  
+  public void setMasterPanelColumnLayout(String aMasterPanelColumnLayout) {
+    myMasterPanelColumnLayout = aMasterPanelColumnLayout;
+  }
+  
+  public void setBounds(String aName, Rectangle b) {
+    prefs.putInt("invisible.framebounds."+aName+".x",b.x);
+    prefs.putInt("invisible.framebounds."+aName+".y",b.y);
+    prefs.putInt("invisible.framebounds."+aName+".width",b.width);
+    prefs.putInt("invisible.framebounds."+aName+".height",b.height);
+  }
+  
+  public Rectangle getBounds(String aName, int aWidth, int aHeight) {
+    int x = prefs.getInt("invisible.framebounds."+aName+".x",100);
+    int y = prefs.getInt("invisible.framebounds."+aName+".y",100);
+    int w = prefs.getInt("invisible.framebounds."+aName+".width",aWidth);
+    int h = prefs.getInt("invisible.framebounds."+aName+".height",aHeight);
+    return new Rectangle(x,y,w,h); 
+  }
+  
+  public void setMultiPaneSizes(int fx, int fy, int tx, int ty) {
+    prefs.putInt("invisible.multipane.folder.x",fx);
+    prefs.putInt("invisible.multipane.folder.y",fy);
+    prefs.putInt("invisible.multipane.thread.x",tx);
+    prefs.putInt("invisible.multipane.thread.y",ty);
+  }
+  
+  public int getMultiPaneFolderX(int aDefault) {
+    return prefs.getInt("invisible.multipane.folder.x", aDefault);
+  }
+
+  public int getMultiPaneFolderY(int aDefault) {
+    return prefs.getInt("invisible.multipane.folder.y", aDefault);
+  }
+
+  public int getMultiPaneThreadX(int aDefault) {
+    return prefs.getInt("invisible.multipane.thread.x", aDefault);
+  }
+
+  public int getMultiPaneThreadY(int aDefault) {
+    return prefs.getInt("invisible.multipane.thread.y", aDefault);
+  }
+
+}
diff --git a/grendel/prefs/base/Makefile b/grendel/prefs/base/Makefile
new file mode 100644
index 000000000000..621f291ec04a
--- /dev/null
+++ b/grendel/prefs/base/Makefile
@@ -0,0 +1,31 @@
+#!gmake
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.0 (the "License"); you may not use this file except in
+# compliance with the License.  You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+# 
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+# the License for the specific language governing rights and limitations
+# under the License.
+# 
+# The Original Code is the Grendel mail/news client.
+# 
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation.  Portions created by Netscape are Copyright (C) 1997
+# Netscape Communications Corporation.  All Rights Reserved.
+#
+# Contributors: Giao Nguyen <grail@cafebabe.org>
+
+SRCS=                     \
+  GeneralPrefs.java       \
+  IdentityArray.java      \
+	IdentityStructure.java  \
+  InvisiblePrefs.java        \
+  ServerArray.java        \
+	ServerStructure.java    \
+  UIPrefs.java            \
+	$(NULL)
+
+include ../../rules.mk
diff --git a/grendel/prefs/base/ServerArray.java b/grendel/prefs/base/ServerArray.java
new file mode 100644
index 000000000000..59187ed67ce4
--- /dev/null
+++ b/grendel/prefs/base/ServerArray.java
@@ -0,0 +1,106 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+import java.util.Vector;
+
+import calypso.util.Preferences;
+import calypso.util.PreferencesFactory;
+
+public class ServerArray {
+
+  private static ServerArray MasterServerArray;
+  
+  public static synchronized ServerArray GetMaster() {
+    if (MasterServerArray == null) {
+      MasterServerArray = new ServerArray();
+    }
+    return MasterServerArray;
+  }
+
+  Vector svs = new Vector();
+  Preferences prefs;
+  
+  private ServerArray() {
+    prefs = PreferencesFactory.Get();
+    readPrefs();
+  }
+  
+  public void readPrefs () {
+
+    for (int i=0; i<prefs.getInt("server.count",1); i++) {
+      ServerStructure sv = new ServerStructure();
+      sv.setDescription           (prefs.getString ("server."+i+".description","Default Server"));
+      sv.setHost                  (prefs.getString ("server."+i+".host",""));
+      sv.setPort                  (prefs.getInt    ("server."+i+".port",-1));
+      sv.setType                  (prefs.getString ("server."+i+".type","pop3"));
+      sv.setUsername              (prefs.getString ("server."+i+".username",""));
+      sv.setPassword              (prefs.getString ("server."+i+".password",""));
+      sv.setDefaultIdentity       (prefs.getInt    ("server."+i+".default_identity",0));
+      sv.setBerkeleyDirectory     (prefs.getString ("server."+i+".berkeley.directory",""));
+      sv.setPOP3ShowAsImap        (prefs.getBoolean("server."+i+".pop3.showasimap",true));
+      sv.setPOP3LeaveMailOnServer (prefs.getBoolean("server."+i+".pop3.leavemailonserver",false));
+      add(sv);
+    }
+    
+    writePrefs();
+
+  }
+  
+  public void writePrefs () {
+    
+    prefs.putInt("server.count",size());
+    
+    for (int i=0; i<size(); i++) {
+      
+      prefs.putString ("server."+i+".description"           ,get(i).getDescription());
+      prefs.putString ("server."+i+".host"                  ,get(i).getHost());
+      prefs.putInt    ("server."+i+".port"                  ,get(i).getPort());
+      prefs.putString ("server."+i+".type"                  ,get(i).getType());
+      prefs.putString ("server."+i+".username"              ,get(i).getUsername());
+      prefs.putString ("server."+i+".password"              ,get(i).getPassword());
+      prefs.putInt    ("server."+i+".default_identity"      ,get(i).getDefaultIdentity());
+      prefs.putString ("server."+i+".berkeley.directory"    ,get(i).getBerkeleyDirectory());
+      prefs.putBoolean("server."+i+".pop3.showasimap"       ,get(i).getPOP3ShowAsImap());
+      prefs.putBoolean("server."+i+".pop3.leavemailonserver",get(i).getPOP3LeaveMailOnServer());
+      
+    }
+    
+  }
+  
+  public ServerStructure get (int Index) {
+    return (ServerStructure)svs.elementAt(Index);
+  }
+  
+  public void add (ServerStructure aServer) {
+    svs.add(aServer);
+  }
+  
+  public void remove (int Index) {
+    svs.removeElementAt(Index);
+  }
+  
+  public int size () {
+    return svs.size();
+  }
+
+}
\ No newline at end of file
diff --git a/grendel/prefs/base/ServerStructure.java b/grendel/prefs/base/ServerStructure.java
new file mode 100644
index 000000000000..d248379e53e5
--- /dev/null
+++ b/grendel/prefs/base/ServerStructure.java
@@ -0,0 +1,128 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+public class ServerStructure {
+
+  String myDescription = "";
+  String myHost = "";
+  int myPort = -1;
+  String myType = "";
+  String myUsername = "";
+  String myPassword = "";
+  int myDefaultIdentity = 0;
+  
+  String myBerkeleyDirectory = "";
+  
+  boolean myPOP3ShowAsImap = true;
+  boolean myPOP3LeaveMailOnServer = false;
+  
+  public ServerStructure() {
+  }
+
+  public ServerStructure(String aDescription) {
+    
+    myDescription = aDescription;
+    
+  }
+  
+  public String getDescription() {
+    return myDescription;
+  }
+
+  public String getHost() {
+    return myHost;
+  }
+
+  public int getPort() {
+    return myPort;
+  }
+
+  public String getType() {
+    return myType;
+  }
+
+  public String getUsername() {
+    return myUsername;
+  }
+
+  public String getPassword() {
+    return myPassword;
+  }
+
+  public int getDefaultIdentity() {
+    return myDefaultIdentity;
+  }
+
+  public String getBerkeleyDirectory() {
+    return myBerkeleyDirectory;
+  }
+
+  public boolean getPOP3LeaveMailOnServer() {
+    return myPOP3LeaveMailOnServer;
+  }
+
+  public boolean getPOP3ShowAsImap() {
+    return myPOP3ShowAsImap;
+  }
+
+  public void setDescription(String aDescription) {
+    myDescription = aDescription;
+  }
+
+  public void setHost(String aHost) {
+    myHost = aHost;
+  }
+
+  public void setPort(int aPort) {
+    myPort = aPort;
+  }
+
+  public void setType(String aType) {
+    myType = aType;
+  }
+
+  public void setUsername(String aUsername) {
+    myUsername = aUsername;
+  }
+
+  public void setPassword(String aPassword) {
+    myPassword = aPassword;
+  }
+
+  public void setDefaultIdentity(int aDefaultIdentity) {
+    myDefaultIdentity = aDefaultIdentity;
+  }
+
+  public void setBerkeleyDirectory(String aBerkeleyDirectory) {
+    myBerkeleyDirectory = aBerkeleyDirectory;
+  }
+
+  public void setPOP3LeaveMailOnServer(boolean aPOP3LeaveMailOnServer) {
+    myPOP3LeaveMailOnServer = aPOP3LeaveMailOnServer;
+  }
+
+  public void setPOP3ShowAsImap(boolean aPOP3ShowAsImap) {
+    myPOP3ShowAsImap = aPOP3ShowAsImap;
+  }
+
+}
\ No newline at end of file
diff --git a/grendel/prefs/base/UIPrefs.java b/grendel/prefs/base/UIPrefs.java
new file mode 100644
index 000000000000..5e9992d222e3
--- /dev/null
+++ b/grendel/prefs/base/UIPrefs.java
@@ -0,0 +1,90 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.base;
+
+import calypso.util.Preferences;
+import calypso.util.PreferencesFactory;
+
+import grendel.ui.UnifiedMessageDisplayManager;
+
+public class UIPrefs {
+
+  private static UIPrefs MasterUIPrefs;
+  
+  public static synchronized UIPrefs GetMaster() {
+    if (MasterUIPrefs == null) {
+      MasterUIPrefs = new UIPrefs();
+    }
+    return MasterUIPrefs;
+  }
+
+  Preferences prefs;
+  
+  private UIPrefs() {
+    prefs = PreferencesFactory.Get();
+    readPrefs();
+  }
+
+  public void readPrefs() {
+    setDisplayManager (prefs.getString ("ui.displaymanager","unified"));
+    setTooltips       (prefs.getBoolean("ui.tooltips",true));
+    setMultiPaneLayout(prefs.getString ("ui.multipanelayout",UnifiedMessageDisplayManager.SPLIT_RIGHT));
+    writePrefs();
+  }
+  
+  public void writePrefs() {
+    prefs.putString ("ui.displaymanager" ,getDisplayManager());
+    prefs.putBoolean("ui.tooltips"       ,getTooltips());
+    prefs.putString ("ui.multipanelayout",getMultiPaneLayout());
+ }
+  
+  String myDisplayManager;
+  boolean myTooltips;
+  String myMultiPaneLayout;
+  
+  public String getDisplayManager() {
+    return myDisplayManager;
+  }
+  
+  public boolean getTooltips() {
+    return myTooltips;
+  }
+  
+  public String getMultiPaneLayout() {
+    return myMultiPaneLayout;
+  }
+  
+  public void setDisplayManager(String aDisplayManager) {
+    myDisplayManager = aDisplayManager;
+  }
+  
+  public void setTooltips(boolean aTooltips) {
+    myTooltips = aTooltips;
+  }
+  
+  public void setMultiPaneLayout(String aMultiPaneLayout) {
+    myMultiPaneLayout = aMultiPaneLayout;
+  }
+  
+}
+
+  
\ No newline at end of file
diff --git a/grendel/prefs/ui/General.java b/grendel/prefs/ui/General.java
new file mode 100644
index 000000000000..4a0f317bdf6e
--- /dev/null
+++ b/grendel/prefs/ui/General.java
@@ -0,0 +1,123 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.ui;
+
+import java.util.Vector;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.JButton;
+
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+
+import grendel.prefs.base.GeneralPrefs;
+
+import grendel.ui.UnifiedMessageDisplayManager;
+
+
+public class General extends JFrame {
+
+  GeneralPrefs prefs = GeneralPrefs.GetMaster();
+
+  JTextField tfSMTP;
+  
+  public static void main(String argv[]) {
+    
+    General ui = new General();
+    ui.show();
+    
+  }
+ 
+  public General() {
+    
+    super();
+    
+    setSize(500,354);
+    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+    getContentPane().setLayout(null);
+
+    JLabel label = new JLabel("SMTP Server");
+    label.setBounds(12,12,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+
+    tfSMTP = new JTextField("");
+    tfSMTP.setBounds(100,12,300,tfSMTP.getPreferredSize().height);
+    getContentPane().add(tfSMTP);
+
+    JButton button = new JButton("Cancel");
+    button.setBounds(334,290,68,button.getPreferredSize().height);
+    button.addActionListener(new CancelActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    getContentPane().add(button);
+    button = new JButton("Finish");
+    button.setBounds(414,290,68,button.getPreferredSize().height);
+    button.addActionListener(new FinishActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    getContentPane().add(button);
+
+    getData();
+  }
+  
+  void getData() {
+    tfSMTP.setText(prefs.getSMTPServer());
+  }
+  
+  void setData() {
+    prefs.setSMTPServer(tfSMTP.getText());
+  }
+  
+  class FinishActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      setData();
+      prefs.writePrefs();
+      hide();
+      dispose();
+    	
+    }
+  
+  }  
+  
+  class CancelActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      hide();
+      dispose();
+    	
+    }
+  
+  }
+  
+}
diff --git a/grendel/prefs/ui/Identities.java b/grendel/prefs/ui/Identities.java
new file mode 100644
index 000000000000..78eb55f180e6
--- /dev/null
+++ b/grendel/prefs/ui/Identities.java
@@ -0,0 +1,258 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.ui;
+
+import java.util.Vector;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JEditorPane;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ListSelectionModel;
+
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import grendel.prefs.base.IdentityArray;
+import grendel.prefs.base.IdentityStructure;
+
+
+public class Identities extends JFrame {
+  
+  JList list;
+  JTextField tfDesc;
+  JTextField tfName;
+  JTextField tfEMail;
+  JTextField tfReply;
+  JTextField tfOrg;
+  JTextArea taSig;
+  
+  IdentityArray ida;
+  IdentityListModel ilm;
+  int currentSelection = -1;
+  
+  public static void main(String argv[]) {
+    
+    Identities ident = new Identities();
+    ident.show();
+    
+  }
+ 
+  public Identities() {
+    
+    super();
+    
+    ida = IdentityArray.GetMaster();
+
+    setSize(500,354);
+    getContentPane().setLayout(null);
+    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+    
+    ilm = new IdentityListModel();
+    list = new JList(ilm);
+    list.setSelectedIndex(0);
+    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+    list.setBounds(12,12,142,306);
+    list.addListSelectionListener(new SelectionChangedListener());
+    getContentPane().add(list);
+    
+    JLabel label = new JLabel("Description");
+    label.setBounds(174,12,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+    label = new JLabel("Name");
+    label.setBounds(174,44,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+    label = new JLabel("E-Mail");
+    label.setBounds(174,76,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+    label = new JLabel("Reply-To");
+    label.setBounds(174,108,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+    label = new JLabel("Organization");
+    label.setBounds(174,140,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+    label = new JLabel("Signature");
+    label.setBounds(174,172,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+    
+    tfDesc = new JTextField();
+    tfDesc.setBounds(254,12,228,tfDesc.getPreferredSize().height);
+    getContentPane().add(tfDesc);
+
+    tfName = new JTextField();
+    tfName.setBounds(254,44,228,tfName.getPreferredSize().height);
+    getContentPane().add(tfName);
+
+    tfEMail = new JTextField();
+    tfEMail.setBounds(254,76,228,tfEMail.getPreferredSize().height);
+    getContentPane().add(tfEMail);
+
+    tfReply = new JTextField();
+    tfReply.setBounds(254,108,228,tfReply.getPreferredSize().height);
+    getContentPane().add(tfReply);
+
+    tfOrg = new JTextField();
+    tfOrg.setBounds(254,140,228,tfOrg.getPreferredSize().height);
+    getContentPane().add(tfOrg);
+    
+    taSig = new JTextArea();
+    taSig.setFont(new Font("monospaced",Font.PLAIN,12));
+    JScrollPane scroll = new JScrollPane(taSig);
+    scroll.setBounds(174,190,308,88);
+    getContentPane().add(scroll);
+
+    JButton button = new JButton("Add New");
+    button.setBounds(174,290,94,button.getPreferredSize().height);
+    button.addActionListener(new AddNewActionListener());
+    getContentPane().add(button);
+    button = new JButton("Delete");
+    button.setBounds(281,290,94,button.getPreferredSize().height);
+    button.addActionListener(new DeleteActionListener());
+    getContentPane().add(button);
+    button = new JButton("Finish");
+    button.setBounds(388,290,94,button.getPreferredSize().height);
+    button.addActionListener(new FinishActionListener());
+    getContentPane().add(button);
+
+    update();
+
+  }
+  
+  private void update() {
+    
+    if (currentSelection > -1) {
+      ida.get(currentSelection).setDescription(tfDesc.getText());
+      ida.get(currentSelection).setName(tfName.getText());
+      ida.get(currentSelection).setEMail(tfEMail.getText());
+      ida.get(currentSelection).setReplyTo(tfReply.getText());
+      ida.get(currentSelection).setOrganization(tfOrg.getText());
+      ida.get(currentSelection).setSignature(taSig.getText());
+    }
+    
+    tfDesc.setText(ida.get(list.getSelectedIndex()).getDescription());
+    tfName.setText(ida.get(list.getSelectedIndex()).getName());
+    tfEMail.setText(ida.get(list.getSelectedIndex()).getEMail());
+    tfReply.setText(ida.get(list.getSelectedIndex()).getReplyTo());
+    tfOrg.setText(ida.get(list.getSelectedIndex()).getOrganization());
+    taSig.setText(ida.get(list.getSelectedIndex()).getSignature());
+    
+    currentSelection = list.getSelectedIndex();
+    
+  }
+  
+  
+  class SelectionChangedListener implements ListSelectionListener {
+  
+    public void valueChanged(ListSelectionEvent e) {
+       
+      if (e.getValueIsAdjusting()) {
+      	
+        update();
+        
+      }
+       
+    }
+  	
+  }
+  
+  class AddNewActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      ida.add(new IdentityStructure("New Identity"));
+      ilm.fireAdded(ida.size()-1);
+      list.setSelectedIndex(ida.size()-1);
+      update();
+    	
+    }
+  
+  }
+  
+  class DeleteActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+    	int index = list.getSelectedIndex();
+      ida.remove(index);
+      ilm.fireRemoved(index);
+      currentSelection = -1;
+      if (index >= ida.size()) { 
+        index = ida.size()-1; 
+      }
+      if (ida.size() <= 0) {
+        ida.add(new IdentityStructure("New Identity"));
+        index = 0;
+      }
+      list.setSelectedIndex(index);
+      update();
+    	
+    }
+  
+  }
+  
+  class FinishActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      update();
+      ida.writePrefs();
+      hide();
+      dispose();
+    	
+    }
+  
+  }
+  
+  class IdentityListModel extends AbstractListModel {
+    
+    public Object getElementAt(int index) {
+      return ida.get(index).getDescription();
+    }
+    
+    public int getSize() {
+      return ida.size();
+    }
+    
+    public void fireAdded(int index) {
+      fireIntervalAdded(this, index, index);
+    }
+    
+    public void fireRemoved(int index) {
+      fireIntervalRemoved(this, index, index);
+    }
+    
+  }
+  
+}
\ No newline at end of file
diff --git a/grendel/prefs/ui/Makefile b/grendel/prefs/ui/Makefile
new file mode 100644
index 000000000000..6ca80f03f6b2
--- /dev/null
+++ b/grendel/prefs/ui/Makefile
@@ -0,0 +1,28 @@
+#!gmake
+#
+# The contents of this file are subject to the Mozilla Public License
+# Version 1.0 (the "License"); you may not use this file except in
+# compliance with the License.  You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+# 
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+# the License for the specific language governing rights and limitations
+# under the License.
+# 
+# The Original Code is the Grendel mail/news client.
+# 
+# The Initial Developer of the Original Code is Netscape Communications
+# Corporation.  Portions created by Netscape are Copyright (C) 1997
+# Netscape Communications Corporation.  All Rights Reserved.
+#
+# Contributors: Giao Nguyen <grail@cafebabe.org>
+
+SRCS=               \
+  General.java      \
+	Identities.java   \
+	Servers.java      \
+	UI.java           \
+	$(NULL)
+
+include ../../rules.mk
diff --git a/grendel/prefs/ui/Servers.java b/grendel/prefs/ui/Servers.java
new file mode 100644
index 000000000000..4d5aee2f67d5
--- /dev/null
+++ b/grendel/prefs/ui/Servers.java
@@ -0,0 +1,478 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.ui;
+
+import java.util.Vector;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+
+import javax.swing.AbstractListModel;
+import javax.swing.ButtonGroup;
+import javax.swing.ListSelectionModel;
+
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import grendel.prefs.base.ServerArray;
+import grendel.prefs.base.ServerStructure;
+import grendel.prefs.base.IdentityArray;
+import grendel.prefs.base.IdentityStructure;
+
+import grendel.ui.StoreFactory;
+
+
+public class Servers extends JFrame {
+  
+  JPanel         pane;
+  
+  JList          list;
+
+  JTextField     tfDesc;
+  JComboBox      cbType;
+
+  JTextField     tfHost;
+  JTextField     tfPort;
+  JTextField     tfUser;
+  JPasswordField tfPass;
+  JComboBox      cbIdent;
+  
+  JTextField     tfDir;
+  JButton        btChoose;
+  
+  JRadioButton   rbToLocal;
+  JRadioButton   rbAsImap;
+  JCheckBox      cbLeave;
+  JComboBox      cbStore;
+
+  JLabel         lbDesc;
+  JLabel         lbHost;
+  JLabel         lbPort;
+  JLabel         lbUser;
+  JLabel         lbPass;
+  JLabel         lbDir;
+  JLabel         lbIdent;
+  
+  ServerArray sva;
+  ServerListModel slm;
+  int currentSelection = -1;
+  
+  public static void main(String argv[]) {
+    
+    Servers servers = new Servers();
+    servers.show();
+    
+  }
+ 
+  public Servers() {
+    
+    super();
+    
+    sva = ServerArray.GetMaster();
+
+    setSize(500,354);
+    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+    
+    pane = new JPanel();
+    pane.setLayout(null);
+    getContentPane().add(pane);
+    
+    slm = new ServerListModel();
+    list = new JList(slm);
+    list.setSelectedIndex(0);
+    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+    list.setBounds(12,12,142,306);
+    list.addListSelectionListener(new SelectionChangedListener());
+    pane.add(list);
+    
+    lbDesc = new JLabel("Description");
+    lbDesc.setBounds(174,12,lbDesc.getPreferredSize().width,lbDesc.getPreferredSize().height);
+    pane.add(lbDesc);
+    lbHost = new JLabel("Hostname");
+    lbHost.setBounds(174,60,lbHost.getPreferredSize().width,lbHost.getPreferredSize().height);
+    pane.add(lbHost);
+    lbPort = new JLabel("Port");
+    lbPort.setBounds(414,60,lbPort.getPreferredSize().width,lbPort.getPreferredSize().height);
+    pane.add(lbPort);
+    lbUser = new JLabel("Username");
+    lbUser.setBounds(174,92,lbUser.getPreferredSize().width,lbUser.getPreferredSize().height);
+    pane.add(lbUser);
+    lbPass = new JLabel("Password");
+    lbPass.setBounds(334,92,lbPass.getPreferredSize().width,lbPass.getPreferredSize().height);
+    pane.add(lbPass);
+    lbDir = new JLabel("Directory");
+    lbDir.setBounds(174,60,lbDir.getPreferredSize().width,lbDir.getPreferredSize().height);
+    pane.add(lbDir);
+    lbIdent = new JLabel("Default identity");
+    lbIdent.setBounds(174,244,lbIdent.getPreferredSize().width,lbIdent.getPreferredSize().height);
+    pane.add(lbIdent);
+    
+    tfDesc = new JTextField();
+    tfDesc.setBounds(254,12,156,tfDesc.getPreferredSize().height);
+    pane.add(tfDesc);
+
+    tfHost = new JTextField();
+    tfHost.setBounds(244,60,160,tfHost.getPreferredSize().height);
+    pane.add(tfHost);
+    
+    tfPort = new JTextField();
+    tfPort.setBounds(442,60,40,tfPort.getPreferredSize().height);
+    pane.add(tfPort);
+
+    tfUser = new JTextField();
+    tfUser.setBounds(244,92,76,tfUser.getPreferredSize().height);
+    pane.add(tfUser);
+
+    tfPass = new JPasswordField();
+    tfPass.setBounds(404,92,76,tfPass.getPreferredSize().height);
+    pane.add(tfPass);
+    
+    tfDir = new JTextField();
+    tfDir.setBounds(254,60,156,tfDir.getPreferredSize().height);
+    pane.add(tfDir);
+
+    btChoose = new JButton("Choose");
+    btChoose.setMargin(new Insets(0,0,0,0));
+    btChoose.setBounds(422,58,60,btChoose.getPreferredSize().height);
+    btChoose.addActionListener(new ChooseDirectoryActionListener());
+    pane.add(btChoose);
+
+    rbToLocal = new JRadioButton("Download everything to a local store");
+    rbToLocal.setBounds(174,140,rbToLocal.getPreferredSize().width,rbToLocal.getPreferredSize().height);
+    pane.add(rbToLocal);
+    rbAsImap = new JRadioButton("Manipulate everything on the server");
+    rbAsImap.setBounds(174,204,rbAsImap.getPreferredSize().width,rbAsImap.getPreferredSize().height);
+    pane.add(rbAsImap);
+    
+    ButtonGroup bg = new ButtonGroup();
+    bg.add(rbToLocal);
+    bg.add(rbAsImap);
+    
+    cbLeave = new JCheckBox("But leave all mail on the server");
+    cbLeave.setBounds(190,160,cbLeave.getPreferredSize().width,cbLeave.getPreferredSize().height);
+    pane.add(cbLeave);
+
+    Vector ids = new Vector();
+    IdentityArray idprefs = IdentityArray.GetMaster();
+    for (int i=0; i<idprefs.size(); i++) {
+      ids.add(idprefs.get(i).getDescription());
+    }
+    cbIdent = new JComboBox(ids);
+    cbIdent.setBounds(270,240,212,cbIdent.getPreferredSize().height);
+    pane.add(cbIdent);
+    
+    JButton button = new JButton("Add New");
+    button.setBounds(174,290,68,button.getPreferredSize().height);
+    button.addActionListener(new AddNewActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    pane.add(button);
+    button = new JButton("Delete");
+    button.setBounds(254,290,68,button.getPreferredSize().height);
+    button.addActionListener(new DeleteActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    pane.add(button);
+    button = new JButton("Cancel");
+    button.setBounds(334,290,68,button.getPreferredSize().height);
+    button.addActionListener(new FinishActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    pane.add(button);
+    button = new JButton("Finish");
+    button.setBounds(414,290,68,button.getPreferredSize().height);
+    button.addActionListener(new FinishActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    pane.add(button);
+
+    String[] data = {"type","local","pop3","imap","news"};
+    cbType = new JComboBox(data);
+    cbType.addActionListener(new TypeChangedListener());
+    cbType.setBounds(422,10,60,cbType.getPreferredSize().height);
+    pane.add(cbType);
+
+    update();
+
+  }
+  
+  private void update() {
+    
+    String type = "";
+    
+    if (currentSelection > -1) {
+      sva.get(currentSelection).setDescription(tfDesc.getText());
+      sva.get(currentSelection).setHost       (tfHost.getText());
+      sva.get(currentSelection).setPort       (Integer.parseInt(tfPort.getText()));
+      sva.get(currentSelection).setUsername   (tfUser.getText());
+      sva.get(currentSelection).setPassword   (tfPass.getText());
+      int index = cbType.getSelectedIndex();
+      if (index == 1) { type = "berkeley"; }
+      if (index == 2) { type = "pop3"; }
+      if (index == 3) { type = "imap"; }
+      if (index == 4) { type = "news"; }
+      sva.get(currentSelection).setType       (type);
+      sva.get(currentSelection).setBerkeleyDirectory(tfDir.getText());
+      sva.get(currentSelection).setDefaultIdentity(cbIdent.getSelectedIndex());
+    }
+    
+    tfDesc.setText(sva.get(list.getSelectedIndex()).getDescription());
+    tfHost.setText(sva.get(list.getSelectedIndex()).getHost());
+    tfPort.setText("" + sva.get(list.getSelectedIndex()).getPort());
+    tfUser.setText(sva.get(list.getSelectedIndex()).getUsername());
+    tfPass.setText(sva.get(list.getSelectedIndex()).getPassword());
+    int index = 0;
+    type = sva.get(list.getSelectedIndex()).getType();
+    if (type.equals("berkeley")) { index = 1; }
+    if (type.equals("pop3"    )) { index = 2; }
+    if (type.equals("imap"    )) { index = 3; }
+    if (type.equals("news"    )) { index = 4; }
+    cbType.setSelectedIndex(index);
+    tfDir.setText(sva.get(list.getSelectedIndex()).getBerkeleyDirectory());
+    cbIdent.setSelectedIndex(sva.get(list.getSelectedIndex()).getDefaultIdentity());
+    
+    currentSelection = list.getSelectedIndex();
+    
+  }
+  
+  void showNothing() {
+    tfHost.hide(); lbHost.hide();
+    tfPort.hide(); lbPort.hide();
+    tfUser.hide(); lbUser.hide();
+    tfPass.hide(); lbPass.hide();
+    cbIdent.hide();lbIdent.hide();
+
+    tfDir.hide();  lbDir.hide();  btChoose.hide();
+  
+    rbToLocal.hide();
+    rbAsImap.hide();
+    cbLeave.hide();
+
+    pane.repaint(new Rectangle(pane.getSize()));
+  }
+  
+  void showBerkeley() {
+    tfHost.hide(); lbHost.hide();
+    tfPort.hide(); lbPort.hide();
+    tfUser.hide(); lbUser.hide();
+    tfPass.hide(); lbPass.hide();
+    cbIdent.show();lbIdent.show();
+
+    tfDir.show();  lbDir.show();  btChoose.show();
+  
+    rbToLocal.hide();
+    rbAsImap.hide();
+    cbLeave.hide();
+
+    pane.repaint(new Rectangle(pane.getSize()));
+  }
+  
+  void showPOP3() {
+    tfHost.show(); lbHost.show();
+    tfPort.show(); lbPort.show();
+    tfUser.show(); lbUser.show();
+    tfPass.show(); lbPass.show();
+    cbIdent.show();lbIdent.show();
+
+    tfDir.hide();  lbDir.hide();  btChoose.hide();
+  
+    rbToLocal.show();
+    rbAsImap.show();
+    cbLeave.show();
+
+    pane.repaint(new Rectangle(pane.getSize()));
+  }
+  
+  void showIMAP() {
+    tfHost.show(); lbHost.show();
+    tfPort.show(); lbPort.show();
+    tfUser.show(); lbUser.show();
+    tfPass.show(); lbPass.show();
+    cbIdent.show();lbIdent.show();
+
+    tfDir.hide();  lbDir.hide();  btChoose.hide();
+  
+    rbToLocal.hide();
+    rbAsImap.hide();
+    cbLeave.hide();
+
+    pane.repaint(new Rectangle(pane.getSize()));
+  }
+  
+  void showNews() {
+    tfHost.show(); lbHost.show();
+    tfPort.show(); lbPort.show();
+    tfUser.hide(); lbUser.hide();
+    tfPass.hide(); lbPass.hide();
+    cbIdent.show();lbIdent.show();
+
+    tfDir.hide();  lbDir.hide();  btChoose.hide();
+  
+    rbToLocal.hide();
+    rbAsImap.hide();
+    cbLeave.hide();
+    
+    pane.repaint(new Rectangle(pane.getSize()));
+  }
+  
+  void chooseDir() {
+    JFileChooser fc = new JFileChooser();
+    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+    if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
+      tfDir.setText(fc.getSelectedFile().getAbsolutePath());
+    }
+  }
+    
+  class SelectionChangedListener implements ListSelectionListener {
+  
+    public void valueChanged(ListSelectionEvent e) {
+       
+      if (e.getValueIsAdjusting()) {
+      	
+        update();
+        
+      }
+       
+    }
+  	
+  }
+  
+  class AddNewActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      sva.add(new ServerStructure("New Server"));
+      slm.fireAdded(sva.size()-1);
+      list.setSelectedIndex(sva.size()-1);
+      update();
+    	
+    }
+  
+  }
+  
+  class DeleteActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+    	int index = list.getSelectedIndex();
+      sva.remove(index);
+      slm.fireRemoved(index);
+      currentSelection = -1;
+      if (index >= sva.size()) { 
+        index = sva.size()-1; 
+      }
+      if (sva.size() <= 0) {
+        sva.add(new ServerStructure("New Server"));
+        index = 0;
+      }
+      list.setSelectedIndex(index);
+      update();
+    	
+    }
+  
+  }
+  
+  class FinishActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      update();
+      sva.writePrefs();
+      StoreFactory.Instance().refreshStores();
+      hide();
+      dispose();
+    	
+    }
+  
+  }
+  
+  class CancelActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      sva.readPrefs();
+      hide();
+      dispose();
+    	
+    }
+  
+  }
+  
+  class TypeChangedListener implements ActionListener {
+    
+    public void actionPerformed(ActionEvent e) {
+      int index = cbType.getSelectedIndex();
+      if (index == 0) { showNothing(); }
+      if (index == 1) { showBerkeley(); }
+      if (index == 2) { showPOP3(); }
+      if (index == 3) { showIMAP(); }
+      if (index == 4) { showNews(); }
+    }
+    
+  }
+  
+  class ChooseDirectoryActionListener implements ActionListener {
+    
+    public void actionPerformed(ActionEvent e) {
+      chooseDir();
+    }
+    
+  }
+  
+  class ServerListModel extends AbstractListModel {
+    
+    public Object getElementAt(int index) {
+      return sva.get(index).getDescription();
+    }
+    
+    public int getSize() {
+      return sva.size();
+    }
+    
+    public void fireAdded(int index) {
+      fireIntervalAdded(this, index, index);
+    }
+    
+    public void fireRemoved(int index) {
+      fireIntervalRemoved(this, index, index);
+    }
+    
+  }
+  
+}
\ No newline at end of file
diff --git a/grendel/prefs/ui/UI.java b/grendel/prefs/ui/UI.java
new file mode 100644
index 000000000000..7b4076833739
--- /dev/null
+++ b/grendel/prefs/ui/UI.java
@@ -0,0 +1,211 @@
+/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * The Original Code is the Grendel mail/news client.
+ *
+ * The Initial Developer of the Original Code is Edwin Woudt 
+ * <edwin@woudt.nl>.  Portions created by Edwin Woudt are 
+ * Copyright (C) 1999 Edwin Woudt.  All Rights Reserved.
+ *
+ * Contributors: 
+ */
+
+package grendel.prefs.ui;
+
+import java.util.Vector;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.Insets;
+import java.awt.Rectangle;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import java.net.URL;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+
+import grendel.prefs.base.UIPrefs;
+
+import grendel.ui.UnifiedMessageDisplayManager;
+
+
+public class UI extends JFrame {
+
+  UIPrefs prefs = UIPrefs.GetMaster();
+
+  JRadioButton rb1, rb2, rb3, rb4, rb5;
+  JCheckBox    cbTooltips;
+  
+  public static void main(String argv[]) {
+    
+    UI ui = new UI();
+    ui.show();
+    
+  }
+ 
+  public UI() {
+    
+    super();
+    
+    setSize(500,354);
+    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+    getContentPane().setLayout(null);
+
+    JLabel label = new JLabel("Choose your window layout:");
+    label.setBounds(12,12,label.getPreferredSize().width,label.getPreferredSize().height);
+    getContentPane().add(label);
+
+    JLabel icon; URL iconUrl;
+    
+    iconUrl = getClass().getResource("images/multi.gif");
+    icon = new JLabel(new ImageIcon(iconUrl));
+    icon.setBounds(48,44,icon.getPreferredSize().width,icon.getPreferredSize().height);
+    getContentPane().add(icon);
+    iconUrl = getClass().getResource("images/right.gif");
+    icon = new JLabel(new ImageIcon(iconUrl));
+    icon.setBounds(138,44,icon.getPreferredSize().width,icon.getPreferredSize().height);
+    getContentPane().add(icon);
+    iconUrl = getClass().getResource("images/top.gif");
+    icon = new JLabel(new ImageIcon(iconUrl));
+    icon.setBounds(228,44,icon.getPreferredSize().width,icon.getPreferredSize().height);
+    getContentPane().add(icon);
+    iconUrl = getClass().getResource("images/left.gif");
+    icon = new JLabel(new ImageIcon(iconUrl));
+    icon.setBounds(318,44,icon.getPreferredSize().width,icon.getPreferredSize().height);
+    getContentPane().add(icon);
+    iconUrl = getClass().getResource("images/stacked.gif");
+    icon = new JLabel(new ImageIcon(iconUrl));
+    icon.setBounds(408,44,icon.getPreferredSize().width,icon.getPreferredSize().height);
+    getContentPane().add(icon);
+    
+    rb1 = new JRadioButton("");
+    rb1.setBounds(26,44,rb1.getPreferredSize().width,rb1.getPreferredSize().height);
+    getContentPane().add(rb1);
+    rb2 = new JRadioButton("");
+    rb2.setBounds(116,44,rb2.getPreferredSize().width,rb2.getPreferredSize().height);
+    getContentPane().add(rb2);
+    rb3 = new JRadioButton("");
+    rb3.setBounds(206,44,rb3.getPreferredSize().width,rb3.getPreferredSize().height);
+    getContentPane().add(rb3);
+    rb4 = new JRadioButton("");
+    rb4.setBounds(296,44,rb4.getPreferredSize().width,rb4.getPreferredSize().height);
+    getContentPane().add(rb4);
+    rb5 = new JRadioButton("");
+    rb5.setBounds(386,44,rb5.getPreferredSize().width,rb5.getPreferredSize().height);
+    getContentPane().add(rb5);
+    
+    ButtonGroup bg = new ButtonGroup();
+    bg.add(rb1); bg.add(rb2); bg.add(rb3); bg.add(rb4); bg.add(rb5);
+
+    cbTooltips = new JCheckBox("Show tooltips");
+    cbTooltips.setBounds(12,100,cbTooltips.getPreferredSize().width, cbTooltips.getPreferredSize().height);
+    getContentPane().add(cbTooltips);
+
+    JButton button = new JButton("Cancel");
+    button.setBounds(334,290,68,button.getPreferredSize().height);
+    button.addActionListener(new CancelActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    getContentPane().add(button);
+    button = new JButton("Finish");
+    button.setBounds(414,290,68,button.getPreferredSize().height);
+    button.addActionListener(new FinishActionListener());
+    button.setMargin(new Insets(0,0,0,0));
+    getContentPane().add(button);
+
+    getData();
+  }
+  
+  void getData() {
+    if (prefs.getDisplayManager().equals("multi")) {
+      rb1.setSelected(true);
+    } else {
+      if (prefs.getMultiPaneLayout().equals(UnifiedMessageDisplayManager.SPLIT_RIGHT)) {
+        rb2.setSelected(true);
+      }
+      if (prefs.getMultiPaneLayout().equals(UnifiedMessageDisplayManager.SPLIT_TOP)) {
+        rb3.setSelected(true);
+      }
+      if (prefs.getMultiPaneLayout().equals(UnifiedMessageDisplayManager.SPLIT_LEFT)) {
+        rb4.setSelected(true);
+      }
+      if (prefs.getMultiPaneLayout().equals(UnifiedMessageDisplayManager.STACKED)) {
+        rb5.setSelected(true);
+      }
+    }
+    if (prefs.getTooltips()) {
+      cbTooltips.setSelected(true);
+    }
+  }
+  
+  void setData() {
+    if (rb1.isSelected()) {
+      prefs.setDisplayManager("multi");
+    }
+    if (rb2.isSelected()) {
+      prefs.setDisplayManager("unified");
+      prefs.setMultiPaneLayout(UnifiedMessageDisplayManager.SPLIT_RIGHT);
+    }
+    if (rb3.isSelected()) {
+      prefs.setDisplayManager("unified");
+      prefs.setMultiPaneLayout(UnifiedMessageDisplayManager.SPLIT_TOP);
+    }
+    if (rb4.isSelected()) {
+      prefs.setDisplayManager("unified");
+      prefs.setMultiPaneLayout(UnifiedMessageDisplayManager.SPLIT_LEFT);
+    }
+    if (rb5.isSelected()) {
+      prefs.setDisplayManager("unified");
+      prefs.setMultiPaneLayout(UnifiedMessageDisplayManager.STACKED);
+    }
+    if (cbTooltips.isSelected()) {
+      prefs.setTooltips(true);
+    } else {
+      prefs.setTooltips(false);
+    }
+  }
+  
+  class FinishActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      setData();
+      prefs.writePrefs();
+      hide();
+      dispose();
+    	
+    }
+  
+  }  
+  
+  class CancelActionListener implements ActionListener {
+  
+    public void actionPerformed(ActionEvent e) {
+    	
+      hide();
+      dispose();
+    	
+    }
+  
+  }
+  
+}
diff --git a/grendel/prefs/ui/images/left.gif b/grendel/prefs/ui/images/left.gif
new file mode 100644
index 000000000000..73c64c108e3f
Binary files /dev/null and b/grendel/prefs/ui/images/left.gif differ
diff --git a/grendel/prefs/ui/images/multi.gif b/grendel/prefs/ui/images/multi.gif
new file mode 100644
index 000000000000..68fa52fcdc77
Binary files /dev/null and b/grendel/prefs/ui/images/multi.gif differ
diff --git a/grendel/prefs/ui/images/right.gif b/grendel/prefs/ui/images/right.gif
new file mode 100644
index 000000000000..746118fb5170
Binary files /dev/null and b/grendel/prefs/ui/images/right.gif differ
diff --git a/grendel/prefs/ui/images/stacked.gif b/grendel/prefs/ui/images/stacked.gif
new file mode 100644
index 000000000000..634d33ac350b
Binary files /dev/null and b/grendel/prefs/ui/images/stacked.gif differ
diff --git a/grendel/prefs/ui/images/top.gif b/grendel/prefs/ui/images/top.gif
new file mode 100644
index 000000000000..ffa479054188
Binary files /dev/null and b/grendel/prefs/ui/images/top.gif differ
diff --git a/grendel/search/ResultsFrame.java b/grendel/search/ResultsFrame.java
index f3c995598ab8..86920497d7f8 100644
--- a/grendel/search/ResultsFrame.java
+++ b/grendel/search/ResultsFrame.java
@@ -17,6 +17,8 @@
  * Netscape Communications Corporation.  All Rights Reserved.
  *
  * Created: Will Scullin <scullin@netscape.com>, 18 Nov 1997.
+ *
+ * Contributors: Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.search;
@@ -28,7 +30,7 @@ import grendel.ui.GeneralFrame;
 public class ResultsFrame extends GeneralFrame {
 
   public ResultsFrame(Component aComponent) {
-    super("Search Results", "mail.search_results");
+    super("Search Results", "searchresults");
     fPanel.add(aComponent);
 
     restoreBounds();
diff --git a/grendel/search/SearchFrame.java b/grendel/search/SearchFrame.java
index 60958ba589e1..c52bd496fd40 100644
--- a/grendel/search/SearchFrame.java
+++ b/grendel/search/SearchFrame.java
@@ -19,6 +19,7 @@
  * Created: Will Scullin <scullin@netscape.com>,  9 Oct 1997.
  *
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.search;
@@ -53,7 +54,7 @@ public class SearchFrame extends GeneralFrame {
   JButton     fCloseButton;
 
   public SearchFrame() {
-    super("Search", "mail.search");
+    super("Search", "search");
 
     fSearchPanel = new SearchPanel(new MailSearch());
     getContentPane().add(fSearchPanel);
diff --git a/grendel/storage/BerkeleyStore.java b/grendel/storage/BerkeleyStore.java
index 8526dec4c11d..32e5839ae655 100644
--- a/grendel/storage/BerkeleyStore.java
+++ b/grendel/storage/BerkeleyStore.java
@@ -17,7 +17,9 @@
  * Netscape Communications Corporation.  All Rights Reserved.
  *
  * Created: Terry Weissman <terry@netscape.com>, 22 Oct 1997.
+ *
  * Contributors: Joel York <joel_york@yahoo.com>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.storage;
@@ -42,26 +44,20 @@ import javax.mail.event.StoreEvent;
   tie into javamail's Session class properly.  So, instead of using
   <tt>Session.getStore(String)</tt>, you instead need to call
   <tt>BerkeleyStore.GetDefaultStore(Session)</tt>.
+  <p>
+  (edwin)BerkeleyStore.GetDefaultStore(Session) has been removed to
+  support multiple berkeley stores. You should construct a berkeley
+  store via the normal way or ask grendel.ui.StoreFactory for a list
+  of available BerkeleyStore's.
   */
 
 public class BerkeleyStore extends Store {
   protected Folder defaultFolder;
-
-  static protected BerkeleyStore DefaultStore = null;
-  public static Store GetDefaultStore(Session s) {
-    if (DefaultStore == null) {
-      DefaultStore = new BerkeleyStore(s);
-    }
-    return DefaultStore;
-  }
-
-
-  public BerkeleyStore(Session s) {
-    super(s, null);
-  }
+  private String Dir;
 
   public BerkeleyStore(Session s, URLName u) {
     super(s, u);
+    Dir = u.getFile();
   }
 
   public void connect(String host,
@@ -85,15 +81,7 @@ public class BerkeleyStore extends Store {
 
   public Folder getDefaultFolder() {
     if (defaultFolder == null) {
-      if (getURLName() == null || getURLName().getFile() == null) {
-        defaultFolder =
-          new BerkeleyFolder(this,
-                             new File(session.getProperty("mail.directory")));
-      } else {
-        defaultFolder =
-          new BerkeleyFolder(this,
-                             new File(getURLName().getFile()));
-      }
+      defaultFolder = new BerkeleyFolder(this, new File(Dir));
     }
     return defaultFolder;
   }
diff --git a/grendel/storage/Makefile b/grendel/storage/Makefile
index 6b5cb820f117..3dccf2867909 100644
--- a/grendel/storage/Makefile
+++ b/grendel/storage/Makefile
@@ -15,6 +15,8 @@
 # The Initial Developer of the Original Code is Netscape Communications
 # Corporation.  Portions created by Netscape are Copyright (C) 1997
 # Netscape Communications Corporation.  All Rights Reserved.
+#
+# Contributors: Edwin Woudt <edwin@woudt.nl>
 
 SUBDIRS=					\
 	addressparser				\
@@ -67,7 +69,6 @@ SRCS=						\
 	PopMessage.java				\
 	PopStore.java				\
 	SearchResultsFolderFactory.java		\
-	TestBerkeley.java			\
 	UnixDotLock.java			\
 	$(NULL)
 
diff --git a/grendel/ui/ActionFactory.java b/grendel/ui/ActionFactory.java
index 07081eca2b9b..dff139c10796 100644
--- a/grendel/ui/ActionFactory.java
+++ b/grendel/ui/ActionFactory.java
@@ -36,15 +36,20 @@ import java.util.ResourceBundle;
 import javax.swing.JFrame;
 import javax.swing.ToolTipManager;
 
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
 //import netscape.orion.uimanager.AbstractUICmd;
 //import netscape.orion.uimanager.IUICmd;
 
+import grendel.prefs.base.UIPrefs;
+import grendel.prefs.ui.Identities;
+import grendel.prefs.ui.Servers;
+import grendel.prefs.ui.General;
+import grendel.prefs.ui.UI;
 import grendel.storage.MailDrop;
 import grendel.search.SearchFrame;
+
+/* Temporarily removed because FilterMaster is broken (edwin)
 import grendel.filters.FilterMaster;
+*/
 
 import grendel.composition.Composition;
 import grendel.ui.UIAction;
@@ -57,6 +62,10 @@ public class ActionFactory {
   static SearchAction fSearchAction = new SearchAction();
   static RunFiltersAction fRunFiltersAction = new RunFiltersAction();
   static ShowTooltipsAction fShowTooltipsAction = new ShowTooltipsAction();
+  static RunIdentityPrefsAction fRunIdentityPrefsAction = new RunIdentityPrefsAction();
+  static RunServerPrefsAction fRunServerPrefsAction = new RunServerPrefsAction();
+  static RunGeneralPrefsAction fRunGeneralPrefsAction = new RunGeneralPrefsAction();
+  static RunUIPrefsAction fRunUIPrefsAction = new RunUIPrefsAction();
   
   static int fIdent = 0;
   
@@ -103,6 +112,22 @@ public class ActionFactory {
   static public ShowTooltipsAction GetShowTooltipsAction() {
     return fShowTooltipsAction;
   }
+  
+  static public RunIdentityPrefsAction GetRunIdentityPrefsAction() {
+    return fRunIdentityPrefsAction;
+  }
+  
+  static public RunServerPrefsAction GetRunServerPrefsAction() {
+    return fRunServerPrefsAction;
+  }
+
+  static public RunGeneralPrefsAction GetRunGeneralPrefsAction() {
+    return fRunGeneralPrefsAction;
+  }
+  
+  static public RunUIPrefsAction GetRunUIPrefsAction() {
+    return fRunUIPrefsAction;
+  }
 }
 
 class ExitAction extends UIAction {
@@ -212,8 +237,10 @@ class RunFiltersAction extends UIAction {
   }
 
   public void actionPerformed(ActionEvent aEvent) {
+    /* Temporarily removed because FilterMaster is broken (edwin)
     FilterMaster fm = FilterMaster.Get();
     fm.applyFiltersToTestInbox();
+    */
   }
 }
 
@@ -222,8 +249,7 @@ class ShowTooltipsAction extends UIAction {
   ShowTooltipsAction() {
     super("appShowTooltips");
 
-    boolean enabled =
-      PreferencesFactory.Get().getBoolean("app.tooltips", true);
+    boolean enabled = UIPrefs.GetMaster().getTooltips();
     ToolTipManager.sharedInstance().setEnabled(enabled);
 
     //    setSelected(enabled ? AbstractUICmd.kSelected : AbstractUICmd.kUnselected);
@@ -233,6 +259,54 @@ class ShowTooltipsAction extends UIAction {
     boolean enabled = !ToolTipManager.sharedInstance().isEnabled();
     ToolTipManager.sharedInstance().setEnabled(enabled);
     //    setSelected(enabled ? AbstractUICmd.kSelected : AbstractUICmd.kUnselected);
-    PreferencesFactory.Get().putBoolean("app.tooltips", enabled);
+    UIPrefs.GetMaster().setTooltips(enabled);
+  }
+}
+
+class RunIdentityPrefsAction extends UIAction {
+  
+  RunIdentityPrefsAction() {
+    super("prefIds");
+  }
+  
+  public void actionPerformed(ActionEvent aEvent) {
+    JFrame prefs = new Identities();
+    prefs.show();
+  }
+}
+
+class RunServerPrefsAction extends UIAction {
+  
+  RunServerPrefsAction() {
+    super("prefSrvs");
+  }
+  
+  public void actionPerformed(ActionEvent aEvent) {
+    JFrame prefs = new Servers();
+    prefs.show();
+  }
+}
+
+class RunGeneralPrefsAction extends UIAction {
+  
+  RunGeneralPrefsAction() {
+    super("prefGeneral");
+  }
+  
+  public void actionPerformed(ActionEvent aEvent) {
+    JFrame prefs = new General();
+    prefs.show();
+  }
+}
+
+class RunUIPrefsAction extends UIAction {
+  
+  RunUIPrefsAction() {
+    super("prefUI");
+  }
+  
+  public void actionPerformed(ActionEvent aEvent) {
+    JFrame prefs = new UI();
+    prefs.show();
   }
 }
diff --git a/grendel/ui/DialogAuthenticator.java b/grendel/ui/DialogAuthenticator.java
index 4e55aa4cb86a..cda011f59925 100644
--- a/grendel/ui/DialogAuthenticator.java
+++ b/grendel/ui/DialogAuthenticator.java
@@ -22,6 +22,8 @@
  *               Edwin Woudt <edwin@woudt.nl>
  */
 
+//### Warning, this code is obsolete now because of prefs changes
+
 package grendel.ui;
 
 import java.awt.Canvas;
@@ -70,6 +72,7 @@ public class DialogAuthenticator extends Authenticator {
     InetAddress site = getRequestingSite();
     String protocol = getRequestingProtocol();
 
+    //### Warning, this code is obsolete now because of prefs changes
     fPrefBase = "mail." + protocol + "-" + site.getHostName();
 
     String user = null;
diff --git a/grendel/ui/FolderFrame.java b/grendel/ui/FolderFrame.java
index bd1b24ae3f68..1a62977296d8 100644
--- a/grendel/ui/FolderFrame.java
+++ b/grendel/ui/FolderFrame.java
@@ -20,6 +20,7 @@
  *
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
  *               Giao Nguyen <grail@cafebabe.org>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.ui;
@@ -44,14 +45,8 @@ public class FolderFrame extends GeneralFrame {
   static Vector fFolderFrames = new Vector();
   FolderPanel   fFolderPanel;
 
-  /**
-   * Identifying String
-   */
-
-  public static final String kID = "mail.folder";
-
   public FolderFrame(Folder aFolder) {
-    super("folderFrameLabel", kID);
+    super("folderFrameLabel", "folder");
 
     fFolderPanel = new FolderPanel();
     fFolderPanel.addFolderPanelListener(new MessageSelectionListener());
diff --git a/grendel/ui/FolderPanel.java b/grendel/ui/FolderPanel.java
index ec05291ac296..585ee4773c91 100644
--- a/grendel/ui/FolderPanel.java
+++ b/grendel/ui/FolderPanel.java
@@ -60,14 +60,12 @@ import javax.swing.ToolTipManager;
 import javax.swing.event.ChangeEvent;
 //import javax.swing.plaf.BorderUIResource;
 
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
 //import netscape.orion.toolbars.NSToolbar;
 //import netscape.orion.uimanager.AbstractUICmd;
 //import netscape.orion.uimanager.IUICmd;
 
 import grendel.composition.Composition;
+import grendel.prefs.base.InvisiblePrefs;
 import grendel.storage.MessageExtra;
 import grendel.storage.MessageExtraFactory;
 import grendel.ui.UIAction;
@@ -341,8 +339,7 @@ public class FolderPanel extends GeneralPanel {
     column.setCellRenderer(cellrenderer);
     fMessageTree.addColumn(column);
 
-    Preferences prefs = PreferencesFactory.Get();
-    fColumnModel.setPrefString(prefs.getString("mail.folder_panel.column_layout", ""));
+    fColumnModel.setPrefString(InvisiblePrefs.GetMaster().getFolderPanelColumnLayout());
 
     // Setup keys
     registerKeyboardAction(new DeleteMessageAction(),
@@ -374,9 +371,8 @@ public class FolderPanel extends GeneralPanel {
   public void dispose() {
     setFolder(null);
 
-    Preferences prefs = PreferencesFactory.Get();
-    prefs.putString("mail.folder_panel.column_layout",
-                    fColumnModel.getPrefString());
+    InvisiblePrefs.GetMaster().setFolderPanelColumnLayout(fColumnModel.getPrefString());
+    InvisiblePrefs.GetMaster().writePrefs();
 
     fMessageTree.getSelectionManager().removeSelectionListener(fSelectionListener);
   }
diff --git a/grendel/ui/GeneralFrame.java b/grendel/ui/GeneralFrame.java
index 40fab6474cae..641af9b86646 100644
--- a/grendel/ui/GeneralFrame.java
+++ b/grendel/ui/GeneralFrame.java
@@ -21,6 +21,7 @@
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
  *               Giao Nguyen <grail@cafebabe.org>
  *               Mauro Botelho <mabotelh@bellsouth.net>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.ui;
@@ -84,9 +85,7 @@ import javax.swing.BoxLayout;
 //import xml.tree.TreeBuilder;
 //import xml.tree.XMLNode;
 
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
+import grendel.prefs.base.InvisiblePrefs;
 import grendel.ui.ToolBarLayout;
 import grendel.widgets.*;
 
@@ -318,13 +317,7 @@ public class GeneralFrame extends JFrame
   }
 
   private void saveBounds(String aName) {
-    Preferences prefs = PreferencesFactory.Get();
-    Rectangle bounds = getBounds();
-
-    prefs.putInt(aName + ".x", bounds.x);
-    prefs.putInt(aName + ".y", bounds.y);
-    prefs.putInt(aName + ".width", bounds.width);
-    prefs.putInt(aName + ".height", bounds.height);
+    InvisiblePrefs.GetMaster().setBounds(aName, getBounds());
   }
 
   protected void saveBounds() {
@@ -332,15 +325,7 @@ public class GeneralFrame extends JFrame
   }
 
   private void restoreBounds(String aName, int aWidth, int aHeight) {
-    Preferences prefs = PreferencesFactory.Get();
-    int x, y, w, h;
-
-    x = prefs.getInt(aName + ".x", 100);
-    y = prefs.getInt(aName + ".y", 100);
-    w = prefs.getInt(aName + ".width", aWidth);
-    h = prefs.getInt(aName + ".height", aHeight);
-
-    setBounds(x, y, w, h);
+    setBounds(InvisiblePrefs.GetMaster().getBounds(aName, aWidth, aHeight));
   }
 
   protected void restoreBounds(int aWidth, int aHeight) {
diff --git a/grendel/ui/MasterPanel.java b/grendel/ui/MasterPanel.java
index 900b89b7a230..54950f6c018c 100644
--- a/grendel/ui/MasterPanel.java
+++ b/grendel/ui/MasterPanel.java
@@ -63,9 +63,6 @@ import javax.swing.event.ChangeListener;
 
 import calypso.util.ArrayEnumeration;
 import calypso.util.Assert;
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
 //import netscape.orion.toolbars.NSToolbar;
 //import netscape.orion.uimanager.AbstractUICmd;
 //import netscape.orion.uimanager.IUICmd;
@@ -76,6 +73,8 @@ import javax.mail.Session;
 import javax.mail.Store;
 
 import grendel.composition.Composition;
+import grendel.prefs.base.InvisiblePrefs;
+import grendel.prefs.base.ServerArray;
 import grendel.storage.FolderExtraFactory;
 import grendel.storage.SearchResultsFolderFactory;
 import grendel.ui.UIAction;
@@ -161,8 +160,7 @@ public class MasterPanel extends GeneralPanel {
     column.setCellRenderer(renderer);
     fFolderTree.addColumn(column);
 
-    Preferences prefs = PreferencesFactory.Get();
-    fFolderTree.getColumnModel().setPrefString(prefs.getString("mail.master_panel.column_layout", ""));
+    fFolderTree.getColumnModel().setPrefString(InvisiblePrefs.GetMaster().getMasterPanelColumnLayout());
 
     registerKeyboardAction(new CopyToClipboardAction(),
                            KeyStroke.getKeyStroke(KeyEvent.VK_C,
@@ -215,9 +213,8 @@ public class MasterPanel extends GeneralPanel {
   }
 
   public void dispose() {
-    Preferences prefs = PreferencesFactory.Get();
-    prefs.putString("mail.master_panel.column_layout",
-                    fFolderTree.getColumnModel().getPrefString());
+    InvisiblePrefs.GetMaster().setMasterPanelColumnLayout(fFolderTree.getColumnModel().getPrefString());
+    InvisiblePrefs.GetMaster().writePrefs();
 
     fFolderTree.getSelectionManager().removeSelectionListener(fSelectionListener);
     StoreFactory.Instance().removeChangeListener(fStoreChangeListener);
@@ -384,17 +381,10 @@ public class MasterPanel extends GeneralPanel {
 
       int identity;
       try {
-        Preferences prefs = PreferencesFactory.Get();
-        InetAddress ia = InetAddress.getByName(getSelectedViewedFolder().getViewedStore().getHost());
-        String fPrefBase = "mail." + getSelectedViewedFolder().getViewedStore().getProtocol()
-                    + "-" + ia.getHostName();
-        System.out.println("fPrefBase");
-        identity = prefs.getInt(fPrefBase + ".default-identity", 0);
-      } catch (NullPointerException npe) {
-      	identity = 0;
-      } catch (UnknownHostException uhe) {
-      	uhe.printStackTrace();
-      	identity = 0;
+        int index = getSelectedViewedFolder().getViewedStore().getID();
+        identity = ServerArray.GetMaster().get(index).getDefaultIdentity();
+      } catch (NullPointerException e) {
+        identity = 0;
       }
 
       ActionFactory.setIdent(identity);
@@ -671,13 +661,7 @@ class FolderModel implements TreeTableDataModel {
 
     if (aNode instanceof ViewedStore) {
       if (aID == MasterPanel.kNameID) {
-        String host = ((ViewedStore) aNode).getHost();
-        if (host != null) {
-          return MessageFormat.format(fLabels.getString("remoteStoreLabel"),
-                                                        new Object[] {host});
-        } else {
-          return fLabels.getString("localStoreLabel");
-        }
+        return ((ViewedStore) aNode).getDescription();
       }
       return "";
     }
@@ -814,22 +798,6 @@ class FolderModel implements TreeTableDataModel {
     return new TreePath(pathVector);
   }
 
-  TreePath createTreePath(Folder aFolder) {
-    ViewedStore store =
-      StoreFactory.Instance().getViewedStore(aFolder.getStore());
-    if (store != null) {
-      try {
-        ViewedFolder folder = store.getViewedFolder(aFolder);
-        if (folder != null) {
-          return createTreePath(folder);
-        }
-      } catch (MessagingException e) {
-        e.printStackTrace();
-      }
-    }
-    return null;
-  }
-
   void updateFolder(ViewedFolder aFolder) {
     TreePath path = createTreePath(aFolder);
     if (fListeners != null && path != null) {
diff --git a/grendel/ui/MenuLabels.properties b/grendel/ui/MenuLabels.properties
index 21f9453b0ae5..adb653e2ed3b 100644
--- a/grendel/ui/MenuLabels.properties
+++ b/grendel/ui/MenuLabels.properties
@@ -198,3 +198,18 @@ sortNumberAccel=N
 windowListLabel=Window List...
 windowListAccel=W
 
+#
+# Preferences menu labels
+#
+
+multiPrefsLabel=Preferences
+multiPrefsAccel=P
+
+prefIdsLabel=Identities
+prefIdsAccel=I
+prefSrvsLabel=Servers
+prefSrvsAccel=S
+prefGeneralLabel=General
+prefGeneralAccel=G
+prefUILabel=User interface
+prefUIAccel=U
diff --git a/grendel/ui/Menus.properties b/grendel/ui/Menus.properties
index 6b5e76540104..a27bc1e612e3 100644
--- a/grendel/ui/Menus.properties
+++ b/grendel/ui/Menus.properties
@@ -21,14 +21,14 @@
 #
 # multipane menus
 #
-multiMain=multiFile multiEdit multiView multiMessage
+multiMain=multiFile multiEdit multiView multiMessage multiPreferences
 multiFile=msgNew folderNew msgOpen msgSaveAs - msgGetNew - appExit
 multiEdit=editUndo - editCut editCopy editPaste - folderDelete - appSearch - appPrefs - appRunFilters
 multiView=viewLayout viewSort
 multiMessage=msgNew - msgReply msgReplyAll - fwdInline fwdQuoted fwdAttachment - msgMark
+multiPreferences=prefGeneral prefIds prefSrvs prefUI
 
 multiToolBar=msgGetNew msgNew msgReply fwdQuoted print msgDelete stop
-#multiToolBar=msgGetNew msgNew msgReply msgDelete
 
 viewLayout=splitTop splitLeft splitRight stacked
 
diff --git a/grendel/ui/MessageFrame.java b/grendel/ui/MessageFrame.java
index 6b4f0278fa0d..0ddfadb0024a 100644
--- a/grendel/ui/MessageFrame.java
+++ b/grendel/ui/MessageFrame.java
@@ -20,6 +20,7 @@
  *
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
  *               Giao Nguyen <grail@cafebabe.org>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.ui;
@@ -40,18 +41,12 @@ public class MessageFrame extends GeneralFrame {
   static Vector fMessageFrames = new Vector();
   MessagePanel  fMessagePanel;
 
-  /**
-   * Identifying String
-   */
-
-  public static final String kID = "mail.message";
-
   /**
    * Creates a MessageFrame displaying the given message.
    */
 
   public MessageFrame(Message aMessage) {
-    super("messageFrameLabel", "mail.message");
+    super("messageFrameLabel", "message");
 
     fMessagePanel = new MessagePanel();
 
diff --git a/grendel/ui/MessagePanel.java b/grendel/ui/MessagePanel.java
index 03873abfdae4..ea5430f18063 100644
--- a/grendel/ui/MessagePanel.java
+++ b/grendel/ui/MessagePanel.java
@@ -19,6 +19,7 @@
  * Created: Will Scullin <scullin@netscape.com>,  3 Sep 1997.
  *
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.ui;
@@ -76,8 +77,6 @@ import calypso.net.URLSource;
 */
 
 import calypso.util.ByteBuf;
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
 
 //import netscape.orion.uimanager.IUICmd;
 
@@ -108,10 +107,8 @@ public class MessagePanel extends GeneralPanel {
   public MessagePanel() {
     fPanel = this;
 
-    Preferences prefs = PreferencesFactory.Get();
-    //    useMagellan = prefs.getBoolean("usemagellan", true);
     useMagellan = false;
-    makeRealHTML = prefs.getBoolean("makerealhtml", true);
+    makeRealHTML = true;
 
     if (useMagellan) {
       //    fViewer = (URLComponent) URLComponentFactory.NewURLComponent(null);
diff --git a/grendel/ui/MultiMessageDisplayManager.java b/grendel/ui/MultiMessageDisplayManager.java
index 0413d17c7291..1eed07d06d38 100644
--- a/grendel/ui/MultiMessageDisplayManager.java
+++ b/grendel/ui/MultiMessageDisplayManager.java
@@ -20,6 +20,7 @@
  *
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
  *               Giao Nguyen <grail@cafebabe.org>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.ui;
@@ -124,7 +125,7 @@ class MasterFrame extends GeneralFrame {
   MasterPanel fMasterPanel;
 
   public MasterFrame() {
-    super("masterFrameLabel", "mail.session");
+    super("masterFrameLabel", "session");
 
     PrefsDialog.CheckPrefs(this);
 
diff --git a/grendel/ui/ProgressFrame.java b/grendel/ui/ProgressFrame.java
index c87a0a56aede..05f1bdb9cde9 100644
--- a/grendel/ui/ProgressFrame.java
+++ b/grendel/ui/ProgressFrame.java
@@ -55,7 +55,7 @@ public abstract class ProgressFrame extends GeneralFrame implements Runnable {
   Container       fContentPanel;
 
   public ProgressFrame(String aCaption) {
-    super("", "mail.progress");
+    super("", "progress");
 
     setTitle(fLabels.getString(aCaption));
     setBackground(UIManager.getColor("control"));
diff --git a/grendel/ui/StoreFactory.java b/grendel/ui/StoreFactory.java
index b72ab90fe382..e69cf8b4f9ee 100644
--- a/grendel/ui/StoreFactory.java
+++ b/grendel/ui/StoreFactory.java
@@ -24,6 +24,7 @@
 
 package grendel.ui;
 
+import java.util.Properties;
 import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 import java.util.Vector;
@@ -39,9 +40,8 @@ import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 import javax.swing.event.EventListenerList;
 
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
+import grendel.prefs.base.ServerArray;
+import grendel.prefs.base.ServerStructure;
 import grendel.view.ViewedStore;
 import grendel.view.ViewedStoreBase;
 
@@ -63,10 +63,11 @@ public class StoreFactory {
   EventListenerList fListeners = new EventListenerList();
 
   private StoreFactory() {
-    Preferences prefs = PreferencesFactory.Get();
-    fAuthenticator = new DialogAuthenticator();
-    fSession = Session.getDefaultInstance(prefs.getAsProperties(),
-                                 fAuthenticator);
+    //Preferences prefs = PreferencesFactory.Get();
+    //fAuthenticator = new DialogAuthenticator();
+    //fSession = Session.getDefaultInstance(prefs.getAsProperties(),
+    //                             fAuthenticator);
+    fSession = Session.getDefaultInstance(new Properties(),null);
     fSession.setDebug(true);
   }
 
@@ -89,45 +90,29 @@ public class StoreFactory {
     return fStores;
   }
 
-  synchronized ViewedStore createStore(String storename) {
-    ResourceBundle labels = ResourceBundle.getBundle("grendel.ui.Labels");
-    URLName urlName = null;
+  private synchronized ViewedStore createStore(int ID) {
 
-    String proto;
+    ServerStructure prefs = ServerArray.GetMaster().get(ID);
 
-    if (storename.indexOf(":") != -1) {
-      urlName = new URLName(storename);
-    } else {
-      urlName = new URLName(storename, null, -1, null, null, null);
-    }
-
-    proto = urlName.getProtocol();
-
-    // ### Very wrong temporary hack -- special case "berkeley" and "pop3",
-    // since they doesn't play with the proper registration mechanism right
-    // now.
     Store store = null;
     ViewedStore viewedStore = null;
 
+    String proto = prefs.getType();
+    URLName urlName = new URLName(proto,null,-1,null,null,null);
+
+    // ### Very wrong temporary hack -- these protocols should be registered 
+    // correctly with JavaMail trough the javamail.providers file
+
     try {
       Class c = null;
       if (proto.equalsIgnoreCase("berkeley")) {
         c = Class.forName("grendel.storage.BerkeleyStore");
-      // Two pop3 providers  
-      } else if (proto.equalsIgnoreCase("gpop3")) {
-        c = Class.forName("grendel.storage.PopStore");
-      } else if (proto.equalsIgnoreCase("spop3")) {
-        c = Class.forName("com.sun.mail.pop3.POP3Store;");
-      // Two news providers  
-      } else if (proto.equalsIgnoreCase("gnews")) {
-        c = Class.forName("grendel.storage.NewsStore");
-      } else if (proto.equalsIgnoreCase("dnews")) {
-        c = Class.forName("dog.mail.nntp.NNTPStore");
-      // Defaults
+        urlName = new URLName(proto,null,-1,prefs.getBerkeleyDirectory(),null,null);
       } else if (proto.equalsIgnoreCase("pop3")) {
         c = Class.forName("com.sun.mail.pop3.POP3Store;");
       } else if (proto.equalsIgnoreCase("news")) {
-        c = Class.forName("grendel.storage.NewsStore");
+        c = Class.forName("dog.mail.nntp.NNTPStore");
+        //c = Class.forName("grendel.storage.NewsStore");
       }
 
       if (c != null) {
@@ -154,93 +139,37 @@ public class StoreFactory {
       }
     }
 
-    viewedStore = new ViewedStoreBase(store,
-                                      urlName.getProtocol(),
-                                      urlName.getHost(),
-                                      urlName.getPort(),
-                                      urlName.getUsername());
+    viewedStore = new ViewedStoreBase(store, ID);
+
     return viewedStore;
   }
-
-  public ViewedStore getViewedStore(Store aStore) {
-    if (fStores == null) {
-      return null;
-    }
-
-    for (int i = 0; i < fStores.length; i++) {
-      if (fStores[i].getStore().equals(aStore)) {
-        return fStores[i];
+  
+  private synchronized void closeStores() {
+    for (int i=0; i<fStores.length; i++) {
+      try {
+        fStores[i].getStore().close();
+      } catch (MessagingException mex) {
+        mex.printStackTrace();
       }
     }
-    return null;
   }
 
-  boolean SafeEquals(Object a, Object b) {
-    if (a == b) {
-      return true;
-    } else if (a != null && b != null) {
-      return a.equals(b);
-    } else {
-      return false;
-    }
-  }
-
-  public ViewedStore findStore(String storename) {
-    URLName urlName = null;
-
-    if (storename.indexOf(":") != -1) {
-      urlName = new URLName(storename);
-    } else {
-      urlName = new URLName(storename, null, -1, null, null, null);
-    }
-    for (int i = 0; fStores != null && i < fStores.length; i++) {
-      if (urlName.getProtocol().equals(fStores[i].getProtocol())) {
-        if (SafeEquals(urlName.getHost(), fStores[i].getHost()) &&
-            SafeEquals(urlName.getUsername(), fStores[i].getUsername()) &&
-            //SafeEquals(urlName.getFile(), fStores[i].getFile()) &&
-            urlName.getPort() == fStores[i].getPort()) {
-          return fStores[i];
-        }
-      }
-    }
-    return null;
-  }
-
-  synchronized void updateStores() {
+  private synchronized void updateStores() {
     if (fSession == null) {
       getSession();
     }
 
-    Preferences prefs = PreferencesFactory.Get();
-    Vector resVector = new Vector();
-
-    String defStore = "";
-    if (!prefs.getString("mail.directory","").equals("")) {
-      defStore = "berkeley";
+    if (fStores != null) {
+      closeStores();
     }
+        
+    ServerArray prefs = ServerArray.GetMaster();
 
-    String storelist = prefs.getString("mail.storelist", defStore);
-    StringTokenizer st = new StringTokenizer(storelist, " ,;");
-
-    while (st.hasMoreTokens()) {
-      String storename = st.nextToken().trim();
-
-      ViewedStore viewedStore = null;
-
-      viewedStore = findStore(storename);
-      if (viewedStore == null) {
-        viewedStore = createStore(storename);
-        System.out.println("created " + viewedStore);
-      } else {
-        System.out.println("recycled " + viewedStore);
-      }
-
-      if (viewedStore != null) {
-        resVector.addElement(viewedStore);
-      }
+    fStores = new ViewedStore[prefs.size()];
+    
+    for (int i=0; i<prefs.size(); i++) {
+      fStores[i] = createStore(i);
     }
-    fStores = new ViewedStore[resVector.size()];
-    resVector.copyInto(fStores);
   }
 
   public synchronized void refreshStores() {
diff --git a/grendel/ui/UnifiedMessageDisplayManager.java b/grendel/ui/UnifiedMessageDisplayManager.java
index 9d7df5e54a44..2bacbac127e5 100644
--- a/grendel/ui/UnifiedMessageDisplayManager.java
+++ b/grendel/ui/UnifiedMessageDisplayManager.java
@@ -41,9 +41,6 @@ import javax.swing.JToolBar;
 import javax.swing.JSplitPane;
 import javax.swing.event.ChangeEvent;
 
-import calypso.util.Preferences;
-import calypso.util.PreferencesFactory;
-
 //import netscape.orion.toolbars.NSToolbar;
 //import netscape.orion.toolbars.ToolbarFactory;
 //import netscape.orion.toolbars.ToolBarLayout;
@@ -55,8 +52,9 @@ import javax.mail.Folder;
 import javax.mail.Message;
 import javax.mail.MessagingException;
 
+import grendel.prefs.base.InvisiblePrefs;
+import grendel.prefs.base.UIPrefs;
 import grendel.ui.UIAction;
-
 import grendel.view.ViewedMessage;
 import grendel.widgets.CollapsiblePanel;
 import grendel.widgets.GrendelToolBar;
@@ -161,7 +159,7 @@ class UnifiedMessageFrame extends GeneralFrame {
   boolean relayout = false;
 
   public UnifiedMessageFrame() {
-    super("appNameLabel", "mail.multi_pane");
+    super("appNameLabel", "multipane");
 
     PrefsDialog.CheckPrefs(this);
 
@@ -183,10 +181,7 @@ class UnifiedMessageFrame extends GeneralFrame {
     fThreads.addFolderPanelListener(listener);
     fMessage.addMessagePanelListener(listener);
 
-    Preferences prefs = PreferencesFactory.Get();
-    String layout = prefs.getString("mail.multi_pane.layout",
-                                    UnifiedMessageDisplayManager.SPLIT_TOP);
-
+    String layout = UIPrefs.GetMaster().getMultiPaneLayout();
 
     layoutPanels(layout);
 
@@ -230,18 +225,13 @@ class UnifiedMessageFrame extends GeneralFrame {
       fLayout = UnifiedMessageDisplayManager.SPLIT_TOP;
     }
 
-    Preferences prefs = PreferencesFactory.Get();
-
-    prefs.putString("mail.multi_pane.folder_x",
-		    Integer.toString(fFolders.getSize().width));
-    prefs.putString("mail.multi_pane.folder_y",
-		    Integer.toString(fFolders.getSize().height));
-    prefs.putString("mail.multi_pane.thread_x",
-		    Integer.toString(fThreads.getSize().width));
-    prefs.putString("mail.multi_pane.thread_y",
-		    Integer.toString(fThreads.getSize().height));
-    prefs.putString("mail.multi_pane.layout",
-                    fLayout);
+    InvisiblePrefs.GetMaster().setMultiPaneSizes(
+      fFolders.getSize().width, fFolders.getSize().height,
+      fThreads.getSize().width, fThreads.getSize().height
+    );
+    
+    UIPrefs.GetMaster().setMultiPaneLayout(fLayout);
+    UIPrefs.GetMaster().writePrefs();
 
     fFolders.dispose();
     fThreads.dispose();
@@ -275,23 +265,15 @@ class UnifiedMessageFrame extends GeneralFrame {
 
 
     if (relayout == false) {
-      Preferences prefs = PreferencesFactory.Get();
+      InvisiblePrefs prefs = InvisiblePrefs.GetMaster();
 
       // read dimensions out of preferences
       try {
         int tx, ty, fx, fy; // temporary dimensions
-        fx = 
-          Integer.parseInt(prefs.getString("mail.multi_pane.folder_x", 
-                                           Integer.toString(folderX)));
-        fy =
-          Integer.parseInt(prefs.getString("mail.multi_pane.folder_y",
-                                           Integer.toString(folderY)));
-        tx = 
-          Integer.parseInt(prefs.getString("mail.multi_pane.thread_x",
-                                           Integer.toString(threadX)));
-        ty =
-          Integer.parseInt(prefs.getString("mail.multi_pane.thread_y",
-                                           Integer.toString(threadY)));
+        fx = prefs.getMultiPaneFolderX(folderX);
+        fy = prefs.getMultiPaneFolderY(folderY);
+        tx = prefs.getMultiPaneThreadX(threadX);
+        ty = prefs.getMultiPaneThreadY(threadY);
         folderX = fx;
         folderY = fy;
         threadX = tx;
@@ -378,6 +360,10 @@ class UnifiedMessageFrame extends GeneralFrame {
                        ActionFactory.GetSearchAction(),
                        ActionFactory.GetRunFiltersAction(),
                        ActionFactory.GetShowTooltipsAction(),
+                       ActionFactory.GetRunIdentityPrefsAction(),
+                       ActionFactory.GetRunServerPrefsAction(),
+                       ActionFactory.GetRunGeneralPrefsAction(),
+                       ActionFactory.GetRunUIPrefsAction(),
                        fSplitLeftLayoutAction,
                        fSplitRightLayoutAction,
                        fSplitTopLayoutAction,
diff --git a/grendel/ui/menus.xml b/grendel/ui/menus.xml
index d2e57b05808a..75ea32797771 100644
--- a/grendel/ui/menus.xml
+++ b/grendel/ui/menus.xml
@@ -53,10 +53,6 @@
     <menuitem id="appRunFilters" category="edit" action="appRunFilters"
      label="$appRunFiltersLabel" accel="$appRunFiltersAccel"
      description=""/>
-    <menuitem type="separator"/>
-    <menuitem id="appPrefs" category="edit" action="appPrefs"
-     label="$appPrefsLabel" accel="$appPrefsAccel"
-     description=""/>
   </menu>
   <menu id="ViewMenu" category="view"
    label="$multiViewLabel" accel="$multiViewAccel">
@@ -84,30 +80,6 @@
       label="$sortSubjectLabel" accel="$sortSubjectAccel"
       description=""/>
     </menu>
-    <menu id="LayoutMenu" category="view"
-     label="$viewLayoutLabel" accel="$viewLayoutAccel">
-      <menuitem id="splitTop" category="view" action="splitTop"
-       type="radio" group="layout"
-      label="$splitTopLabel" accel="$splitTopAccel"
-      description=""/>
-      <menuitem id="splitLeft" category="view" action="splitLeft"
-       type="radio" group="layout"
-      label="$splitLeftLabel" accel="$splitLeftAccel"
-      description=""/>
-      <menuitem id="splitRight" category="view" action="splitRight"
-       type="radio" group="layout"
-      label="$splitRightLabel" accel="$splitRightAccel"
-      description=""/>
-      <menuitem id="stacked" category="view" action="stacked"
-       type="radio" group="layout"
-       label="$stackedLabel" accel="$stackedAccel"
-       description=""/>
-    </menu>
-    <menuitem type="separator"/>
-    <menuitem id="appShowTooltips" category="view" action="appShowTooltips"
-     type="checkbox"
-     label="$appShowTooltipsLabel" accel="$appShowTooltipsAccel"
-     description=""/>
   </menu>
   <menu id="MessageMenu" category="message"
    label="$multiMessageLabel" accel="$multiMessageAccel">
@@ -144,6 +116,21 @@
       description=""/>
     </menu>
   </menu>
+  <menu id="PrefsMenu" category="prefs"
+   label="$multiPrefsLabel" accel="$multiPrefsAccel">
+   <menuitem id="prefGeneral" category="prefs" action="prefGeneral"
+    label="$prefGeneralLabel" accel="$prefGeneralAccel"
+    description=""/>
+   <menuitem id="prefIds" category="prefs" action="prefIds"
+    label="$prefIdsLabel" accel="$prefIdsAccel"
+    description=""/>
+   <menuitem id="prefSrvs" category="prefs" action="prefSrvs"
+    label="$prefSrvsLabel" accel="$prefSrvsAccel"
+    description=""/>
+   <menuitem id="prefUI" category="prefs" action="prefUI"
+    label="$prefUILabel" accel="$prefUIAccel"
+    description=""/>
+  </menu>
   </menubar>
 </body>
 </xml>
diff --git a/grendel/util/Constants.java b/grendel/util/Constants.java
index 9b87f315be43..5f95a2fb214e 100644
--- a/grendel/util/Constants.java
+++ b/grendel/util/Constants.java
@@ -77,9 +77,9 @@ public class Constants {
   /** Whether this is a OS/2 machine. */
   public final static boolean ISOS2 = os2;
 
-
-  /** File representing the user's home directory. */
+/** File representing the user's home directory. */
   public final static File HOMEDIR = ISUNIX ?
-  new File(System.getProperties().getProperty("user.home")) :
+  new File(System.getProperties().getProperty("user.home")+File.separator+ ".grendel") :
   new File(System.getProperties().getProperty("user.dir"));
+ 
 };
diff --git a/grendel/view/ViewedStore.java b/grendel/view/ViewedStore.java
index 75f2ddc5e25c..d9e97a76a615 100644
--- a/grendel/view/ViewedStore.java
+++ b/grendel/view/ViewedStore.java
@@ -17,6 +17,8 @@
  * Netscape Communications Corporation.  All Rights Reserved.
  *
  * Created: Will Scullin <scullin@netscape.com>,  2 Dec 1997.
+ *
+ * Contributors: Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.view;
@@ -57,6 +59,18 @@ public interface ViewedStore extends ViewedFolder {
 
   public ViewedFolder getDefaultFolder() throws MessagingException;
 
+  /**
+   * Returns the id which identifies this store in the preferences/
+   */
+
+  public int getID();
+
+  /**
+   * Returns the description for this store
+   */
+
+  public String getDescription();
+
   /**
    * Returns the protocol used by this store.
    */
@@ -76,6 +90,12 @@ public interface ViewedStore extends ViewedFolder {
 
   public String getUsername();
 
+  /**
+   * Returns the password.
+   */
+
+  public String getPassword();
+
   /**
    * Returns the port used to connect. Returns -1 for the protocol default.
    */
diff --git a/grendel/view/ViewedStoreBase.java b/grendel/view/ViewedStoreBase.java
index 6d0811ff406b..618dce55df4c 100644
--- a/grendel/view/ViewedStoreBase.java
+++ b/grendel/view/ViewedStoreBase.java
@@ -20,6 +20,7 @@
  *
  * Contributors: Jeff Galyan <talisman@anamorphic.com>
  *               Giao Nguyen <grail@cafebabe.org>
+ *               Edwin Woudt <edwin@woudt.nl>
  */
 
 package grendel.view;
@@ -39,25 +40,22 @@ import javax.mail.event.FolderListener;
 import javax.swing.JOptionPane;
 import javax.swing.event.EventListenerList;
 
-import calypso.util.PreferencesFactory;
-
+import grendel.prefs.base.ServerArray;
+import grendel.prefs.base.IdentityStructure;
 import grendel.storage.FolderExtraFactory;
 
 public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
 
+  int fID;
+  
   Vector fUpdateQueue;
   Thread fUpdateThread;
 
   ViewedFolder fDefaultFolder;
   Store fStore;
-  String fProto;
-  String fHost;
-  String fUser;
-  String fPrefBase;
-  int fPort;
+
   ViewedStore fNext;
   boolean fConnected;
-  boolean fSorted;
 
   int fVisible = kSubscribed;
 
@@ -69,23 +67,24 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
    * state.
    */
 
-  public ViewedStoreBase(Store aStore, String aProto, String aHost,
-                         int aPort, String aUser) {
+  public ViewedStoreBase(Store aStore, int aID) {
     super(null, null, null);
-
+    
+    fID = aID;
     fViewedStore = this;
     fStore = aStore;
-    fProto = aProto;
-    fHost = aHost;
-    fPort = aPort;
-    fUser = aUser;
-
-    fPrefBase = "mail." + aProto + (aHost != null ? "-" + aHost : "");
-    fSorted = PreferencesFactory.Get().getBoolean(fPrefBase + ".sort", false);
 
     fStore.addConnectionListener(new StoreConnectionListener());
   }
 
+  /**
+   * Returns the id which identifies this store in the preferences/
+   */
+
+  public int getID() {
+    return fID;
+  }
+  
   /**
    * Returns the associated folder
    */
@@ -131,12 +130,20 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
     return fDefaultFolder;
   }
 
+  /**
+   * Returns the description for this store
+   */
+
+  public String getDescription() {
+    return ServerArray.GetMaster().get(fID).getDescription();
+  }
+
   /**
    * Returns the protocol used by this store.
    */
 
   public String getProtocol() {
-    return fProto;
+    return ServerArray.GetMaster().get(fID).getType();
   }
 
   /**
@@ -144,7 +151,7 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
    */
 
   public String getHost() {
-    return fHost;
+    return ServerArray.GetMaster().get(fID).getHost();
   }
 
   /**
@@ -153,7 +160,15 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
    */
 
   public String getUsername() {
-    return fUser;
+    return ServerArray.GetMaster().get(fID).getUsername();
+  }
+
+  /**
+   * Returns the password.
+   */
+
+  public String getPassword() {
+    return ServerArray.GetMaster().get(fID).getPassword();
   }
 
   /**
@@ -161,7 +176,7 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
    */
 
   public int getPort() {
-    return fPort;
+    return ServerArray.GetMaster().get(fID).getPort();
   }
 
   /**
@@ -191,7 +206,7 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
   void connectStore() {
     try {
       if (fStore != null) {
-        fStore.connect(getHost(), getUsername(), null);
+        fStore.connect(getHost(), getPort(), getUsername(), getPassword());
       }
     } catch (AuthenticationFailedException e) {
       JOptionPane.showMessageDialog(null,
@@ -210,16 +225,14 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
 
   void checkConnected() throws MessagingException {
     if (!isConnected()) {
-      boolean success = false;
-
-      Thread connect = new Thread(new ConnectThread());
-      connect.start();
-      success = true;
+      //Thread connect = new Thread(new ConnectThread());
+      //connect.start();
+      connectStore();
     }
   }
 
   boolean isSorted() {
-    return fSorted;
+    return true;
   }
 
   /**
@@ -239,13 +252,7 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
   }
 
   public String toString() {
-    StringBuffer buffer = new StringBuffer();
-    buffer.append(fProto);
-    if (fHost != null) {
-      buffer.append(":");
-      buffer.append(fHost);
-    }
-    return buffer.toString();
+    return ServerArray.GetMaster().get(fID).getDescription();
   }
 
   void addFolderUpdate(ViewedFolderBase aFolder) {
@@ -353,7 +360,6 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
       try {
         Folder folder = viewedFolder.getFolder();
         if (folder != null) {
-
           if (!folder.isOpen()) {
             try {
               folder.open(Folder.READ_WRITE);
@@ -368,7 +374,9 @@ public class ViewedStoreBase extends ViewedFolderBase implements ViewedStore {
           viewedFolder.setCounts(messageCount, unreadCount, undeletedCount);
         }
       } catch (MessagingException e) {
+        e.printStackTrace();
       } catch (IllegalStateException e) {
+        e.printStackTrace();
       } catch (Exception e) {
         e.printStackTrace();
       }