diff --git a/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java b/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
index 30f8e2f..d959604 100644
--- a/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
+++ b/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
@@ -41,25 +41,25 @@
         this(secret, new URL(issuer), 72 * 60 * 60);
     }
 
-    public SignedJWT createJWT(User user, Map<String, String> attr) {
+    public SignedJWT createJWT(User user, Map<String, Object> attr) {
         return signContent(user, attr, defaultttl);
     }
 
-    public SignedJWT signContent(User user, Map<String, String> attr, int ttl) {
+    public SignedJWT signContent(User user, Map<String, Object> attr, int ttl) {
         String scopes;
 
         JWTClaimsSet cs = new JWTClaimsSet();
         cs.setIssuerClaim(this.issuer.toString());
 
-        if ((scopes = attr.get(Attributes.SCOPES)) != null) {
-            Scopes claims = Scopes.mapScopes(scopes, user.getDetails());
+        if ((scopes = (String) attr.get(Attributes.SCOPES)) != null) {
+            Scopes claims = Scopes.mapScopes(scopes, attr);
             cs.setCustomClaims(claims.toMap());
         }
 
         cs.setSubjectClaim(user.getUsername());
         if (attr.get(Attributes.CLIENT_ID) != null)
             cs.setAudienceClaim(
-                    new String[] { attr.get(Attributes.CLIENT_ID) });
+                    new String[] { (String) attr.get(Attributes.CLIENT_ID) });
         cs.setExpirationTimeClaim(
                 TimeUtils.getNow().plusSeconds(ttl).getMillis());
         SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256),
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
index c175824..f63a023 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
@@ -38,6 +38,8 @@
         return reflections.getTypesAnnotatedWith(annotation);
     }
 
+
+
     @Deprecated
     public static void registerResourceClasses() {
         PersistenceClient cl = BeanConfiguration.getBeans()
diff --git a/src/main/java/de/ids_mannheim/korap/config/Scopes.java b/src/main/java/de/ids_mannheim/korap/config/Scopes.java
index 63a3f07..cce49e8 100644
--- a/src/main/java/de/ids_mannheim/korap/config/Scopes.java
+++ b/src/main/java/de/ids_mannheim/korap/config/Scopes.java
@@ -1,7 +1,6 @@
 package de.ids_mannheim.korap.config;
 
 import de.ids_mannheim.korap.user.Attributes;
-import de.ids_mannheim.korap.user.UserDetails;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
 import java.util.ArrayList;
@@ -54,18 +53,17 @@
         return s.toArray(new Scope[s.size()]);
     }
 
-    public static Scopes mapScopes(String scopes, UserDetails details) {
+    public static Scopes mapScopes(String scopes, Map<String, Object> details) {
         Scopes m = new Scopes();
-        Map<String, Object> det = details.toMap();
         if (scopes != null && !scopes.isEmpty()) {
             Scope[] scopearr = mapScopes(scopes);
             for (Scope s : scopearr) {
-                Object v = det.get(s.toString());
+                Object v = details.get(s.toString());
                 if (v != null)
                     m._values.put(s.toString(), v);
             }
             if (scopes.contains(Scope.profile.toString()))
-                m._values.putAll(Scopes.getProfileScopes(det)._values);
+                m._values.putAll(Scopes.getProfileScopes(details)._values);
             m._values.put(Attributes.SCOPES, scopes);
         }
         return m;
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java b/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
index c44888f..34aa013 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
@@ -56,7 +56,7 @@
     public static final Integer UNSUPPORTED_CORPUS = 404;
     public static final Integer UNSUPPORTED_LAYER = 405;
     // make a distinction between no and invalid vc?
-    public static final Integer UNSUPPORTED_VIRTUALCOLLECTION = 406;
+    public static final Integer UNSUPPORTED_COLLECTION = 406;
     public static final Integer CORPUS_REWRITE = 407;
     public static final Integer FOUNDRY_REWRITE = 408;
     public static final Integer FOUNDRY_INJECTION = 409;
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
index 38e0834..e87b62d 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
@@ -8,23 +8,22 @@
 import de.ids_mannheim.korap.exceptions.dbException;
 import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
 import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
-import de.ids_mannheim.korap.user.*;
+import de.ids_mannheim.korap.user.DemoUser;
+import de.ids_mannheim.korap.user.KorAPUser;
+import de.ids_mannheim.korap.user.ShibUser;
+import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.BooleanUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.dao.DataAccessException;
 import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.jdbc.support.GeneratedKeyHolder;
 import org.springframework.jdbc.support.KeyHolder;
 
 import java.sql.Date;
-import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -43,185 +42,6 @@
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
-    @Override
-    public UserSettings getUserSettings(Integer userid)
-            throws KustvaktException {
-        //        TransactionDefinition def = new DefaultTransactionDefinition();
-        //        TransactionStatus status = transactionManager.getTransaction(def);
-
-        MapSqlParameterSource np = new MapSqlParameterSource();
-        np.addValue("us", userid);
-        final String sql =
-                "SELECT user.* FROM user_settings as user inner join korap_users as a "
-                        + "on a.id=user.user_id WHERE user.user_id=:us";
-        try {
-            Map s = this.jdbcTemplate.queryForMap(sql, np);
-            return UserSettings.fromObjectMap(s);
-        }catch (EmptyResultDataAccessException ex) {
-            return new UserSettings();
-        }catch (DataAccessException e) {
-            jlog.error("Could not retrieve user settings for user: " + userid,
-                    e);
-            throw new dbException(userid, "user_settings",
-                    StatusCodes.DB_GET_FAILED, userid.toString());
-        }
-    }
-
-    @Override
-    public int updateSettings(UserSettings settings) throws KustvaktException {
-        final String sql =
-                "UPDATE user_settings SET fileNameForExport=:fileNameForExport,"
-                        +
-                        "leftContextItemForExport=:leftContextItemForExport," +
-                        "leftContextSizeForExport=:leftContextSizeForExport,locale=:locale,leftContextItem=:leftContextItem,"
-                        +
-                        "leftContextSize=:leftContextSize," +
-                        "rightContextItem=:rightContextItem,rightContextItemForExport=:rightContextItemForExport,"
-                        +
-                        "rightContextSize=:rightContextSize," +
-                        "POSFoundry=:defaultPOSfoundry, lemmaFoundry=:defaultLemmafoundry, constFoundry=:defaultConstfoundry, "
-                        +
-                        "relFoundry=:defaultRelfoundry, " +
-                        "rightContextSizeForExport=:rightContextSizeForExport,selectedCollection=:selectedCollection,queryLanguage=:queryLanguage,"
-                        +
-                        "pageLength=:pageLength,metadataQueryExpertModus=:metadataQueryExpertModus,collectData=:collectData "
-                        +
-                        "WHERE user_id=:userID";
-        try {
-            return this.jdbcTemplate
-                    .update(sql, new BeanPropertySqlParameterSource(settings));
-        }catch (DataAccessException e) {
-            jlog.error("Could not update user settings for user: " + settings
-                    .getUserID(), e);
-            throw new dbException(settings.getUserID(), "user_settings",
-                    StatusCodes.DB_UPDATE_FAILED, settings.toString());
-        }
-    }
-
-    /**
-     * @param settings
-     * @throws KustvaktException
-     */
-
-    private void createSettings(UserSettings settings)
-            throws KustvaktException {
-        final String sql =
-                "INSERT INTO user_settings (user_id, fileNameForExport,leftContextItemForExport,"
-                        +
-                        "leftContextSizeForExport,locale,leftContextItem,leftContextSize,"
-                        +
-                        "rightContextItem,rightContextItemForExport,rightContextSize,"
-                        +
-                        "rightContextSizeForExport,selectedCollection,queryLanguage,"
-                        +
-                        "pageLength,metadataQueryExpertModus, POSFoundry, lemmaFoundry, constFoundry, relFoundry, collectData) "
-                        +
-                        "VALUES (:userID, :fileNameForExport, :leftContextItemForExport, "
-                        +
-                        ":leftContextSizeForExport, :locale, :leftContextItem, :leftContextSize, "
-                        +
-                        ":rightContextItem,:rightContextItemForExport, :rightContextSize, "
-                        +
-                        ":rightContextSizeForExport, :selectedCollection, :queryLanguage, "
-                        +
-                        ":pageLength, :metadataQueryExpertModus, :defaultPOSfoundry, "
-                        +
-                        ":defaultLemmafoundry, :defaultConstfoundry, :defaultRelfoundry, :collectData);";
-
-        try {
-            if (settings == null)
-                throw new KustvaktException(StatusCodes.MISSING_ARGUMENTS,
-                        "no settings provided", "user settings");
-            this.jdbcTemplate
-                    .update(sql, new BeanPropertySqlParameterSource(settings));
-        }catch (DataAccessException e) {
-            jlog.error("Could not create user settings for user: " + settings
-                    .getUserID(), e);
-            throw new dbException(settings.getUserID(), "userSettings",
-                    StatusCodes.DB_INSERT_FAILED, settings.toString());
-        }
-    }
-
-    @Override
-    public UserDetails getUserDetails(Integer userid) throws KustvaktException {
-        final String sql = "SELECT us.* FROM user_details as us inner join korap_users as ku on ku.id=us.user_id WHERE us.user_id=:user";
-        MapSqlParameterSource np = new MapSqlParameterSource();
-        np.addValue("user", userid);
-
-        try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, np, new RowMapper<UserDetails>() {
-                        @Override
-                        public UserDetails mapRow(ResultSet rs, int i)
-                                throws SQLException {
-                            UserDetails d = new UserDetails();
-                            d.setUserID(rs.getInt("user_id"));
-                            d.setAddress(rs.getString("address"));
-                            d.setCountry(rs.getString("country"));
-                            d.setEmail(rs.getString("email"));
-                            d.setFirstName(rs.getString("firstName"));
-                            d.setLastName(rs.getString("lastName"));
-                            d.setGender(rs.getString("gender"));
-                            d.setInstitution(rs.getString("institution"));
-                            d.setPhone(rs.getString("phone"));
-                            d.setPrivateUsage(rs.getBoolean("privateUsage"));
-                            return d;
-                        }
-                    });
-        }catch (EmptyResultDataAccessException ex) {
-            //todo: create audit record?
-            return null;
-        }catch (DataAccessException e) {
-            jlog.error("Could not retrieve user details for user: " + userid,
-                    e);
-            throw new dbException(userid, "userDetails",
-                    StatusCodes.DB_GET_FAILED, userid.toString());
-        }
-    }
-
-    @Override
-    public int updateUserDetails(UserDetails details) throws KustvaktException {
-        final String up =
-                "UPDATE user_details SET firstName=:firstName, lastName=:lastName, "
-                        +
-                        "gender=:gender, phone=:phone, institution=:institution, "
-                        +
-                        "email=:email, address=:address, country=:country, privateUsage=:privateUsage "
-                        +
-                        "WHERE user_id=:userID;";
-        try {
-            return this.jdbcTemplate
-                    .update(up, new BeanPropertySqlParameterSource(details));
-        }catch (DataAccessException e) {
-            jlog.error("Could not retrieve user details for user: " + details
-                    .getUserID(), e);
-            throw new dbException(details.getUserID(), "userDetails",
-                    StatusCodes.DB_UPDATE_FAILED, details.toString());
-        }
-    }
-
-    private void createUserDetails(UserDetails details)
-            throws KustvaktException {
-        final String up =
-                "INSERT INTO user_details (user_id, firstName, lastName, gender, phone, institution, "
-                        +
-                        "email, address, country, privateUsage) VALUES (:userID, :firstName, :lastName, :gender, "
-                        +
-                        ":phone, :institution, :email, :address, :country, :privateUsage);";
-        try {
-            if (details == null)
-                throw new KustvaktException(StatusCodes.MISSING_ARGUMENTS,
-                        "no details provided", "user details");
-            this.jdbcTemplate
-                    .update(up, new BeanPropertySqlParameterSource(details));
-        }catch (DataAccessException e) {
-            jlog.error("Could not create user details for user: " + details
-                    .getUserID(), e);
-            throw new dbException(details.getUserID(), "userDetails",
-                    StatusCodes.DB_INSERT_FAILED, details.toString());
-        }
-    }
-
     // usersettings are fetched plus basic account info, no details, since i rarely use them anyway!
     @Override
     public User getAccount(String username) throws KustvaktException {
@@ -376,14 +196,6 @@
             int r = this.jdbcTemplate
                     .update(query, np, holder, new String[] { "id" });
             user.setId(holder.getKey().intValue());
-
-            if (user.getDetails() == null)
-                user.setDetails(new UserDetails());
-            if (user.getSettings() == null)
-                user.setSettings(new UserSettings());
-
-            this.createUserDetails(user.getDetails());
-            this.createSettings(user.getSettings());
             return r;
         }catch (DataAccessException e) {
             jlog.error("Could not create user account with username: {}",
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
index 13f29f6..82d6737 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
@@ -11,7 +11,7 @@
     TokenContext getUserStatus(String authToken) throws
             KustvaktException;
 
-    TokenContext createUserSession(User user, Map<String, String> attr)
+    TokenContext createUserSession(User user, Map<String, Object> attr)
             throws KustvaktException;
 
     void removeUserSession(String token) throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
index ccc79d8..8204a4f 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
@@ -1,10 +1,7 @@
 package de.ids_mannheim.korap.interfaces;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.user.UserDetails;
-import de.ids_mannheim.korap.user.UserSettings;
+import de.ids_mannheim.korap.user.*;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -43,35 +40,29 @@
     public abstract User getUser(String username) throws KustvaktException;
 
     public abstract User authenticate(int type, String username,
-            String password, Map<String, String> attributes)
+            String password, Map<String, Object> attributes)
             throws KustvaktException;
 
     public abstract TokenContext createTokenContext(User user,
-            Map<String, String> attr, String provider_key)
+            Map<String, Object> attr, String provider_key)
             throws KustvaktException;
 
     public abstract void logout(TokenContext context) throws KustvaktException;
 
     public abstract void lockAccount(User user) throws KustvaktException;
 
-    public abstract User createUserAccount(Map attributes,
+    public abstract User createUserAccount(Map<String, Object> attributes,
             boolean confirmation_required) throws KustvaktException;
 
-//    public abstract boolean updateAccount(User user) throws KustvaktException;
+    //    public abstract boolean updateAccount(User user) throws KustvaktException;
 
     public abstract boolean deleteAccount(User user) throws KustvaktException;
 
-    public abstract UserDetails getUserDetails(User user)
-            throws KustvaktException;
+    public abstract <T extends Userdata> T getUserData(User user,
+            Class<T> clazz) throws KustvaktException;
 
-    public abstract UserSettings getUserSettings(User user)
-            throws KustvaktException;
+    public abstract void updateUserData(Userdata data) throws KustvaktException;
 
-    public abstract void updateUserDetails(User user, UserDetails details)
-            throws KustvaktException;
-
-    public abstract void updateUserSettings(User user, UserSettings settings)
-            throws KustvaktException;
 
     public abstract Object[] validateResetPasswordRequest(String username,
             String email) throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
index 3b035b4..ec31ed7 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
@@ -64,7 +64,7 @@
 
     public String encodeBase();
 
-    public Map validateMap(Map map) throws KustvaktException;
+    public Map<String, Object> validateMap(Map<String, Object> map) throws KustvaktException;
 
     public String validateEntry(String input, String type)
             throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/EntityHandlerIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/EntityHandlerIface.java
index f349f23..c83f60d 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/EntityHandlerIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/EntityHandlerIface.java
@@ -3,8 +3,6 @@
 import de.ids_mannheim.korap.exceptions.EmptyResultException;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.user.UserDetails;
-import de.ids_mannheim.korap.user.UserSettings;
 
 /**
  * User: hanl
@@ -12,22 +10,9 @@
  * Time: 11:04 AM
  */
 public interface EntityHandlerIface {
-    UserSettings getUserSettings(Integer userid) throws KustvaktException;
 
-    int updateSettings(UserSettings settings) throws KustvaktException;
-
-    UserDetails getUserDetails(Integer userid) throws KustvaktException;
-
-    int updateUserDetails(UserDetails details) throws KustvaktException;
-
-    //    List<UserQuery> getUserQueries(User user) throws KorAPException;
-
-    //    UserQuery getUserQuery(String id) throws KorAPException;
-
-    //    void updateUserQueries(User user, List<UserQuery> newOnes) throws KorAPException;
-
-    User getAccount(String username) throws
-            EmptyResultException, KustvaktException;
+    User getAccount(String username)
+            throws EmptyResultException, KustvaktException;
 
     int updateAccount(User user) throws KustvaktException;
 
@@ -35,8 +20,8 @@
 
     int deleteAccount(Integer userid) throws KustvaktException;
 
-    int resetPassphrase(String username, String uriToken,
-            String passphrase) throws KustvaktException;
+    int resetPassphrase(String username, String uriToken, String passphrase)
+            throws KustvaktException;
 
     int activateAccount(String username, String uriToken)
             throws KustvaktException;
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
index cfa4c99..d35f924 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/ResourceOperationIface.java
@@ -11,6 +11,8 @@
 // todo: user instance only required for auditing pointcut operations
 public interface ResourceOperationIface<T extends KustvaktResource> {
 
+    // todo: remove and use type reference!
+    @Deprecated
     Class<T> getType();
 
     <T extends KustvaktResource> T findbyId(String id, User user)
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
index 2a1cde8..dbd3649 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/KustvaktEncryption.java
@@ -283,7 +283,7 @@
 
     // todo: where applied?
     @Override
-    public Map validateMap(Map map) throws KustvaktException {
+    public Map<String, Object> validateMap(Map<String, Object> map) throws KustvaktException {
         Map<String, Object> safeMap = new HashMap<>();
         KustvaktMap kmap = new KustvaktMap(map);
 
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
index eebc92c..e4a8e4b 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
@@ -16,8 +16,9 @@
     public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
             User user) {
         LayerMapper mapper;
+        // inject user settings from cache!
         if (user != null)
-            mapper = new LayerMapper(config, user.getSettings());
+            mapper = new LayerMapper(config, null);
         else
             mapper = new LayerMapper(config);
 
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
index 4db050a..596941f 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
@@ -122,6 +122,7 @@
     }
 
     private JsonNode process(JsonNode root, User user, boolean post) {
+        jlog.debug("Running rewrite process on query {}", root);
         Iterator<Map.Entry<String, JsonNode>> it = root.fields();
         while (it.hasNext()) {
             Map.Entry<String, JsonNode> next = it.next();
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
index d59e503..297a36e 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/APIAuthentication.java
@@ -58,7 +58,7 @@
     }
 
     @Override
-    public TokenContext createUserSession(User user, Map<String, String> attr)
+    public TokenContext createUserSession(User user, Map<String, Object> attr)
             throws KustvaktException {
         TokenContext c = new TokenContext();
         c.setUsername(user.getUsername());
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java b/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
index 4470a30..e97ea53 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/BasicHttpAuth.java
@@ -74,7 +74,7 @@
 
     // not supported!
     @Override
-    public TokenContext createUserSession(User user, Map<String, String> attr)
+    public TokenContext createUserSession(User user, Map<String, Object> attr)
             throws KustvaktException {
         return null;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
index d34f968..2eca9e0 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManager.java
@@ -12,7 +12,6 @@
 import de.ids_mannheim.korap.user.*;
 import de.ids_mannheim.korap.utils.StringUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
-import de.ids_mannheim.korap.web.utils.KustvaktMap;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
@@ -109,7 +108,7 @@
         AuthenticationIface provider = getProvider(context.getTokenType(),
                 null);
         if (provider == null) {
-
+            //todo:
         }
 
         try {
@@ -128,8 +127,9 @@
      * @return User
      * @throws KustvaktException
      */
+    @Override
     public User authenticate(int type, String username, String password,
-            Map<String, String> attributes) throws KustvaktException {
+            Map<String, Object> attributes) throws KustvaktException {
         User user;
         switch (type) {
             case 1:
@@ -146,19 +146,21 @@
         return user;
     }
 
+    // todo: dont use annotations for caching
+    @Override
     @CachePut(value = "users", key = "#user.getUsername()")
-    public TokenContext createTokenContext(User user, Map<String, String> attr,
+    public TokenContext createTokenContext(User user, Map<String, Object> attr,
             String provider_key) throws KustvaktException {
         AuthenticationIface provider = getProvider(provider_key,
                 Attributes.API_AUTHENTICATION);
 
         if (attr.get(Attributes.SCOPES) != null)
-            this.getUserDetails(user);
+            this.getUserData(user, Userdetails2.class);
 
         TokenContext context = provider.createUserSession(user, attr);
         if (context == null)
             throw new KustvaktException(StatusCodes.NOT_SUPPORTED);
-        context.setUserAgent(attr.get(Attributes.USER_AGENT));
+        context.setUserAgent((String) attr.get(Attributes.USER_AGENT));
         context.setHostAddress(Attributes.HOST);
         return context;
     }
@@ -174,7 +176,7 @@
         return false;
     }
 
-    private User authenticateShib(Map<String, String> attributes)
+    private User authenticateShib(Map<String, Object> attributes)
             throws KustvaktException {
         // todo use persistent id, since eppn is not unique
         String eppn = (String) attributes.get(Attributes.EPPN);
@@ -195,8 +197,8 @@
 
     //todo: what if attributes null?
     private User authenticate(String username, String password,
-            Map<String, String> attr) throws KustvaktException {
-        Map<String, String> attributes = crypto.validateMap(attr);
+            Map<String, Object> attr) throws KustvaktException {
+        Map<String, Object> attributes = crypto.validateMap(attr);
         String safeUS;
         User unknown;
         // just to make sure that the plain password does not appear anywhere in the logs!
@@ -213,8 +215,6 @@
         else {
             try {
                 unknown = entHandler.getAccount(safeUS);
-                unknown.setSettings(
-                        entHandler.getUserSettings(unknown.getId()));
             }catch (EmptyResultException e) {
                 // mask exception to disable user guessing in possible attacks
                 throw new WrappedException(new KustvaktException(username,
@@ -458,11 +458,9 @@
      * @throws KustvaktException
      */
     //fixme: remove clientinfo object (not needed), use json representation to get stuff
-    public User createUserAccount(Map attributes, boolean confirmation_required)
-            throws KustvaktException {
-        KustvaktMap kmap = new KustvaktMap(attributes);
-
-        Map<String, String> safeMap = crypto.validateMap(attributes);
+    public User createUserAccount(Map<String, Object> attributes,
+            boolean confirmation_required) throws KustvaktException {
+        Map<String, Object> safeMap = crypto.validateMap(attributes);
         if (safeMap.get(Attributes.USERNAME) == null || ((String) safeMap
                 .get(Attributes.USERNAME)).isEmpty())
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
@@ -473,10 +471,12 @@
                     StatusCodes.ILLEGAL_ARGUMENT, "password must be set",
                     "password");
 
-        String username = crypto.validateEntry(safeMap.get(Attributes.USERNAME),
-                Attributes.USERNAME);
-        String safePass = crypto.validateEntry(safeMap.get(Attributes.PASSWORD),
-                Attributes.PASSWORD);
+        String username = crypto
+                .validateEntry((String) safeMap.get(Attributes.USERNAME),
+                        Attributes.USERNAME);
+        String safePass = crypto
+                .validateEntry((String) safeMap.get(Attributes.PASSWORD),
+                        Attributes.PASSWORD);
         String hash;
         try {
             hash = crypto.produceSecureHash(safePass);
@@ -486,9 +486,6 @@
         }
 
         KorAPUser user = User.UserFactory.getUser(username);
-        UserDetails det = UserDetails.newDetailsIterator(safeMap);
-        user.setDetails(det);
-        user.setSettings(new UserSettings());
         if (confirmation_required) {
             user.setAccountLocked(true);
             URIParam param = new URIParam(crypto.createToken(),
@@ -498,6 +495,16 @@
         user.setPassword(hash);
         try {
             entHandler.createAccount(user);
+            Userdetails2 details = new Userdetails2(user.getId());
+            details.readDefaults(safeMap);
+            details.checkRequired();
+
+            UserSettings2 settings = new UserSettings2(user.getId());
+            settings.readDefaults(safeMap);
+            settings.checkRequired();
+
+            UserdataFactory.getDaoInstance(Userdetails2.class).store(details);
+            UserdataFactory.getDaoInstance(UserSettings2.class).store(settings);
         }catch (KustvaktException e) {
             throw new WrappedException(e, StatusCodes.CREATE_ACCOUNT_FAILED,
                     user.toString());
@@ -509,11 +516,11 @@
     }
 
     //todo:
-    private ShibUser createShibbUserAccount(Map<String, String> attributes)
+    private ShibUser createShibbUserAccount(Map<String, Object> attributes)
             throws KustvaktException {
         jlog.debug("creating shibboleth user account for user attr: {}",
                 attributes);
-        Map<String, String> safeMap = crypto.validateMap(attributes);
+        Map<String, Object> safeMap = crypto.validateMap(attributes);
 
         //todo eppn non-unique.join with idp or use persistent_id as username identifier
         ShibUser user = User.UserFactory
@@ -634,9 +641,10 @@
                     username), StatusCodes.PASSWORD_RESET_FAILED, username);
         }
 
-        getUserDetails(ident);
+        Userdata data = this.getUserData(ident, Userdetails2.class);
         KorAPUser user = (KorAPUser) ident;
-        if (!mail.equals(user.getDetails().getEmail()))
+
+        if (!mail.equals(data.get(Attributes.EMAIL)))
             //            throw new NotAuthorizedException(StatusCodes.ILLEGAL_ARGUMENT,
             //                    "invalid parameter: email", "email");
             throw new WrappedException(new KustvaktException(user.getId(),
@@ -657,61 +665,53 @@
                 new DateTime(param.getUriExpiration()) };
     }
 
-    public void updateUserSettings(User user, UserSettings settings)
-            throws KustvaktException {
-        if (user instanceof DemoUser)
-            return;
-        else {
-            Map map = crypto.validateMap(settings.toObjectMap());
-            settings = UserSettings.fromObjectMap(map);
-            try {
-                entHandler.updateSettings(settings);
-            }catch (KustvaktException e) {
-                jlog.error("Error ", e);
-                throw new WrappedException(e,
-                        StatusCodes.UPDATE_ACCOUNT_FAILED);
-            }
-        }
-    }
+    @Override
+    public <T extends Userdata> T getUserData(User user, Class<T> clazz)
+            throws WrappedException {
 
-    public void updateUserDetails(User user, UserDetails details)
-            throws KustvaktException {
-        if (user instanceof DemoUser)
-            return;
-        else {
-            Map map = crypto.validateMap(details.toMap());
-
-            try {
-                entHandler
-                        .updateUserDetails(UserDetails.newDetailsIterator(map));
-            }catch (KustvaktException e) {
-                jlog.error("Error ", e);
-                throw new WrappedException(e,
-                        StatusCodes.UPDATE_ACCOUNT_FAILED);
-            }
-        }
-    }
-
-    public UserDetails getUserDetails(User user) throws KustvaktException {
         try {
-            if (user.getDetails() == null)
-                user.setDetails(entHandler.getUserDetails(user.getId()));
+            UserDataDbIface<T> dao = UserdataFactory.getDaoInstance(clazz);
+            return dao.get(user);
         }catch (KustvaktException e) {
+            jlog.error("Error ", e);
             throw new WrappedException(e, StatusCodes.GET_ACCOUNT_FAILED);
         }
-        return user.getDetails();
     }
 
-    public UserSettings getUserSettings(User user) throws KustvaktException {
+    //todo: cache userdata outside of the user object!
+    @Override
+    public void updateUserData(Userdata data) throws WrappedException {
         try {
-            if (user.getSettings() == null)
-                user.setSettings(entHandler.getUserSettings(user.getId()));
+            data.validate(this.crypto);
+            UserDataDbIface dao = UserdataFactory
+                    .getDaoInstance(data.getClass());
+            dao.update(data);
         }catch (KustvaktException e) {
-            throw new WrappedException(e, StatusCodes.GET_ACCOUNT_FAILED);
+            jlog.error("Error ", e);
+            throw new WrappedException(e, StatusCodes.UPDATE_ACCOUNT_FAILED);
         }
-        return user.getSettings();
     }
 
+    //    public UserDetails getUserDetails(User user) throws KustvaktException {
+    //        try {
+    //            if (user.getDetails() == null)
+    //                user.setDetails(entHandler.getUserDetails(user.getId()));
+    //        }catch (KustvaktException e) {
+    //            throw new WrappedException(e, StatusCodes.GET_ACCOUNT_FAILED);
+    //        }
+    //        return user.getDetails();
+    //    }
+    //
+    //    public UserSettings getUserSettings(User user) throws KustvaktException {
+    //        try {
+    //            if (user.getSettings() == null)
+    //                user.setSettings(entHandler.getUserSettings(user.getId()));
+    //        }catch (KustvaktException e) {
+    //            throw new WrappedException(e, StatusCodes.GET_ACCOUNT_FAILED);
+    //        }
+    //        return user.getSettings();
+    //    }
+
     private String cache_key(String input) throws KustvaktException {
         try {
             return crypto.hash(KEY + "@" + input);
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
index a1871c9..3f0ebe4 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/OpenIDconnectAuthentication.java
@@ -44,9 +44,9 @@
     }
 
     @Override
-    public TokenContext createUserSession(User user, Map<String, String> attr)
+    public TokenContext createUserSession(User user, Map<String, Object> attr)
             throws KustvaktException {
-        String cl_secret = attr.get(Attributes.CLIENT_SECRET);
+        String cl_secret = (String) attr.get(Attributes.CLIENT_SECRET);
         if (cl_secret == null)
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
         attr.remove(cl_secret);
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java b/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java
index 3a74954..68b04c8 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/SessionAuthentication.java
@@ -56,7 +56,7 @@
     }
 
     @Override
-    public TokenContext createUserSession(User user, Map attr)
+    public TokenContext createUserSession(User user, Map<String, Object> attr)
             throws KustvaktException {
         DateTime now = TimeUtils.getNow();
         DateTime ex = TimeUtils
diff --git a/src/main/java/de/ids_mannheim/korap/user/DemoUser.java b/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
index c88f5e1..70eb878 100644
--- a/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
+++ b/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
@@ -19,7 +19,7 @@
         this.setDetails(new UserDetails());
         this.setSettings(new UserSettings());
         this.setAccountCreation(ACCOUNT_CREATED);
-        this.setQueries(UserQuery.demoUserQueries());
+//        this.setQueries(UserQuery.demoUserQueries());
     }
 
     protected User clone() {
diff --git a/src/main/java/de/ids_mannheim/korap/user/TokenContext.java b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
index 9eeff3a..a31beab 100644
--- a/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
+++ b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
@@ -33,7 +33,7 @@
 
     @Getter(AccessLevel.PRIVATE)
     @Setter(AccessLevel.PRIVATE)
-    private Map<String, String> parameters;
+    private Map<String, Object> parameters;
     private String hostAddress;
     private String userAgent;
 
@@ -54,7 +54,7 @@
         return m;
     }
 
-    public Map<String, String> params() {
+    public Map<String, Object> params() {
         return new HashMap<>(parameters);
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/user/User.java b/src/main/java/de/ids_mannheim/korap/user/User.java
index 5c4510e..22c8188 100644
--- a/src/main/java/de/ids_mannheim/korap/user/User.java
+++ b/src/main/java/de/ids_mannheim/korap/user/User.java
@@ -5,10 +5,14 @@
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import de.ids_mannheim.korap.web.utils.KustvaktMap;
+import lombok.AccessLevel;
 import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
 import org.joda.time.DateTime;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -26,16 +30,26 @@
     private boolean isAccountLocked;
     private int type;
     private ParamFields fields;
+    @Getter(AccessLevel.PRIVATE)
+    @Setter(AccessLevel.PRIVATE)
     private UserSettings settings;
+    //todo: remove!
+    @Getter(AccessLevel.PRIVATE)
+    @Setter(AccessLevel.PRIVATE)
     private UserDetails details;
+    @Getter(AccessLevel.PRIVATE)
+    @Setter(AccessLevel.PRIVATE)
     private List<UserQuery> queries;
 
+    private List<Userdata> userdata;
+
     protected User() {
         this.fields = new ParamFields();
         this.accountCreation = TimeUtils.getNow().getMillis();
         this.isAccountLocked = false;
         this.username = "";
         this.id = -1;
+        this.userdata = new ArrayList<>();
     }
 
     protected User(int type) {
@@ -58,35 +72,49 @@
 
     //todo: repair transfer
     public void transfer(User user) {
-        this.setSettings(user.getSettings());
-        this.setDetails(user.getDetails());
+        //        this.setSettings(user.getSettings());
+        //        this.setDetails(user.getDetails());
         //        this.setQueries(user.getQueries());
         if (this instanceof KorAPUser) {
-            this.getSettings().setUserID(this.id);
-            this.getDetails().setUserID(this.id);
+
+            //            this.getSettings().setUserID(this.id);
+            //            this.getDetails().setUserID(this.id);
             //            for (UserQuery q : this.getQueries())
             //                q.setOwner(this.accountID);
         }
     }
 
+    public void addUserData(Userdata data) {
+        if (data != null) {
+            for (Userdata d : this.userdata) {
+                // already has an object of that type!
+                if (d.getClass().equals(data.getClass()))
+                    return;
+            }
+            userdata.add(data);
+        }
+    }
+
+    @Deprecated
     public void setDetails(UserDetails details) {
         if (details != null)
             details.setUserID(this.id);
-        this.details = details;
+        //        this.details = details;
     }
 
+    @Deprecated
     public void setSettings(UserSettings settings) {
         if (settings != null)
             settings.setUserID(this.id);
-        this.settings = settings;
+        //        this.settings = settings;
     }
 
     public void setId(Integer id) {
         this.id = id;
-        if (this.settings != null)
-            this.settings.setUserID(this.id);
-        if (this.details != null)
-            this.details.setUserID(this.id);
+        //        if (this.settings != null)
+        //            this.settings.setUserID(this.id);
+        //        if (this.details != null)
+        //            this.details.setUserID(this.id);
     }
 
     public Map<String, Object> toMap() {
@@ -95,15 +123,11 @@
         //TimeUtils.format(new DateTime(this.accountCreation))
         map.put(Attributes.ACCOUNT_CREATION, this.accountCreation);
 
-        if (this.getDetails() != null)
-            map.putAll(this.getDetails().toMap());
+        //        if (this.getDetails() != null)
+        //            map.putAll(this.getDetails().toMap());
         return map;
     }
 
-    public String toJson() {
-        return JsonUtils.toJSON(this.toMap());
-    }
-
     public Map toCache() {
         Map map = new HashMap();
         map.put(Attributes.ID, this.id);
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java b/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
new file mode 100644
index 0000000..7ee663c
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
@@ -0,0 +1,23 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+
+/**
+ * @author hanl
+ * @date 27/01/2016
+ */
+public interface UserDataDbIface<T extends Userdata> {
+
+    public int store(T data) throws KustvaktException;
+
+    public int update(T data) throws KustvaktException;
+
+    public T get(Integer id) throws KustvaktException;
+
+    public T get(User user) throws KustvaktException;
+
+    public int delete(T data) throws KustvaktException;
+
+    public int deleteAll() throws KustvaktException;
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
index e9d74d0..135fbd2 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
@@ -13,6 +13,7 @@
  */
 
 // todo: set certain fields required!
+@Deprecated
 @Data
 public class UserDetails {
 
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java b/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
new file mode 100644
index 0000000..4e16bed
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
@@ -0,0 +1,134 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.jdbc.support.GeneratedKeyHolder;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+
+/**
+ * @author hanl
+ * @date 27/01/2016
+ */
+public class UserDetailsDao implements UserDataDbIface<Userdetails2> {
+
+    private NamedParameterJdbcTemplate jdbcTemplate;
+
+    public UserDetailsDao(PersistenceClient client) {
+        this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
+    }
+
+    @Override
+    public int store(Userdetails2 data) {
+        String sql = "INSERT INTO user_details2 (user_id, data) VALUES (:userid, :data);";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("userid", data.getUserID());
+        source.addValue("data", data.data());
+
+        GeneratedKeyHolder gen = new GeneratedKeyHolder();
+        try {
+            this.jdbcTemplate.update(sql, source, gen);
+            int id = gen.getKey().intValue();
+            data.setId(id);
+            return id;
+        }catch (DataAccessException e) {
+            e.printStackTrace();
+            return -1;
+        }
+    }
+
+    @Override
+    public int update(Userdetails2 data) {
+        String sql = "UPDATE user_details2 SET data = :data WHERE user_id=:userid;";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("userid", data.getUserID());
+        source.addValue("data", data.data());
+
+        try {
+            return this.jdbcTemplate.update(sql, source);
+        }catch (DataAccessException e) {
+            return -1;
+        }
+    }
+
+    @Override
+    public Userdetails2 get(Integer id) {
+        String sql = "SELECT * FROM user_details2 WHERE id=:id;";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("id", id);
+
+        try {
+            return this.jdbcTemplate
+                    .queryForObject(sql, source, new RowMapper<Userdetails2>() {
+
+                        @Override
+                        public Userdetails2 mapRow(ResultSet rs, int rowNum)
+                                throws SQLException {
+                            Userdetails2 details = new Userdetails2(
+                                    rs.getInt("user_id"));
+                            details.setId(rs.getInt("id"));
+                            details.setData(rs.getString("data"));
+                            return details;
+                        }
+                    });
+
+        }catch (DataAccessException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public Userdetails2 get(User user) {
+        String sql = "SELECT * FROM user_details2 WHERE user_id=:userid;";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("userid", user.getId());
+
+        try {
+            return this.jdbcTemplate
+                    .queryForObject(sql, source, new RowMapper<Userdetails2>() {
+
+                        @Override
+                        public Userdetails2 mapRow(ResultSet rs, int rowNum)
+                                throws SQLException {
+                            Userdetails2 details = new Userdetails2(
+                                    rs.getInt("user_id"));
+                            details.setId(rs.getInt("id"));
+                            details.setData(rs.getString("data"));
+                            return details;
+                        }
+                    });
+
+        }catch (DataAccessException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int delete(Userdetails2 data) {
+        String sql = "DELETE FROM user_details2 WHERE id=:id";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("id", data.getId());
+        try {
+            return this.jdbcTemplate.update(sql, source);
+        }catch (DataAccessException e) {
+            return -1;
+        }
+    }
+
+    @Override
+    public int deleteAll() {
+        String sql = "DELETE FROM user_details2;";
+        try {
+            return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
+        }catch (DataAccessException e) {
+            e.printStackTrace();
+            return -1;
+        }
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
index 046ef56..77351e9 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
@@ -15,6 +15,7 @@
  * Time: 10:26 AM
  */
 
+@Deprecated
 @Getter
 @Setter
 public class UserSettings {
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettings2.java b/src/main/java/de/ids_mannheim/korap/user/UserSettings2.java
new file mode 100644
index 0000000..d6b86a9
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettings2.java
@@ -0,0 +1,23 @@
+package de.ids_mannheim.korap.user;
+
+/**
+ * @author hanl
+ * @date 28/01/2016
+ */
+public class UserSettings2 extends Userdata {
+
+
+    public UserSettings2(Integer userid) {
+        super(userid);
+    }
+
+    @Override
+    public String[] requiredFields() {
+        return new String[0];
+    }
+
+    @Override
+    public String[] defaultFields() {
+        return new String[0];
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettingsDao.java b/src/main/java/de/ids_mannheim/korap/user/UserSettingsDao.java
new file mode 100644
index 0000000..c82ac64
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettingsDao.java
@@ -0,0 +1,133 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
+import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
+import org.springframework.jdbc.support.GeneratedKeyHolder;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+
+/**
+ * @author hanl
+ * @date 28/01/2016
+ */
+public class UserSettingsDao implements UserDataDbIface<UserSettings2> {
+
+    NamedParameterJdbcTemplate jdbcTemplate;
+
+    public UserSettingsDao(PersistenceClient client) {
+        this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
+    }
+    @Override
+    public int store(UserSettings2 data) {
+        String sql = "INSERT INTO user_settings2 (user_id, data) VALUES (:userid, :data);";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("userid", data.getUserID());
+        source.addValue("data", data.data());
+
+        GeneratedKeyHolder gen = new GeneratedKeyHolder();
+        try {
+            this.jdbcTemplate.update(sql, source, gen);
+            int id = gen.getKey().intValue();
+            data.setId(id);
+            return id;
+        }catch (DataAccessException e) {
+            e.printStackTrace();
+            return -1;
+        }
+    }
+
+    @Override
+    public int update(UserSettings2 data) {
+        String sql = "UPDATE user_settings2 SET data = :data WHERE user_id=:userid;";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("userid", data.getUserID());
+        source.addValue("data", data.data());
+
+        try {
+            return this.jdbcTemplate.update(sql, source);
+        }catch (DataAccessException e) {
+            return -1;
+        }
+    }
+
+    @Override
+    public UserSettings2 get(Integer id) {
+        String sql = "SELECT * FROM user_settings2 WHERE id=:id;";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("id", id);
+
+        try {
+            return this.jdbcTemplate
+                    .queryForObject(sql, source, new RowMapper<UserSettings2>() {
+
+                        @Override
+                        public UserSettings2 mapRow(ResultSet rs, int rowNum)
+                                throws SQLException {
+                            UserSettings2 details = new UserSettings2(
+                                    rs.getInt("user_id"));
+                            details.setId(rs.getInt("id"));
+                            details.setData(rs.getString("data"));
+                            return details;
+                        }
+                    });
+
+        }catch (DataAccessException e) {
+            return null;
+        }
+    }
+
+    @Override
+    public UserSettings2 get(User user) {
+        String sql = "SELECT * FROM user_settings2 WHERE user_id=:userid;";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("userid", user.getId());
+
+        try {
+            return this.jdbcTemplate
+                    .queryForObject(sql, source, new RowMapper<UserSettings2>() {
+
+                        @Override
+                        public UserSettings2 mapRow(ResultSet rs, int rowNum)
+                                throws SQLException {
+                            UserSettings2 details = new UserSettings2(
+                                    rs.getInt("user_id"));
+                            details.setId(rs.getInt("id"));
+                            details.setData(rs.getString("data"));
+                            return details;
+                        }
+                    });
+
+        }catch (DataAccessException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    @Override
+    public int delete(UserSettings2 data) {
+        String sql = "DELETE FROM user_settings2 WHERE id=:id";
+        MapSqlParameterSource source = new MapSqlParameterSource();
+        source.addValue("id", data.getId());
+        try {
+            return this.jdbcTemplate.update(sql, source);
+        }catch (DataAccessException e) {
+            return -1;
+        }
+    }
+
+    @Override
+    public int deleteAll() {
+        String sql = "DELETE FROM user_settings2;";
+        try {
+            return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
+        }catch (DataAccessException e) {
+            e.printStackTrace();
+            return -1;
+        }
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/Userdata.java b/src/main/java/de/ids_mannheim/korap/user/Userdata.java
new file mode 100644
index 0000000..bf53486
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/Userdata.java
@@ -0,0 +1,134 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
+import de.ids_mannheim.korap.utils.JsonUtils;
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.*;
+
+/**
+ * @author hanl
+ * @date 22/01/2016
+ */
+@Data
+public abstract class Userdata {
+
+    private Integer id;
+    @Getter(AccessLevel.PRIVATE)
+    @Setter(AccessLevel.PRIVATE)
+    private Map<String, Object> fields;
+    @Setter(AccessLevel.PRIVATE)
+    private Integer userID;
+
+    public Userdata(Integer userid) {
+        this.fields = new HashMap<>();
+        this.userID = userid;
+        this.id = -1;
+    }
+
+    public void setData(Map<String, Object> map) throws KustvaktException {
+        Set missing = missing(map);
+        if (!missing.isEmpty())
+            throw new KustvaktException(StatusCodes.MISSING_ARGUMENTS,
+                    missing.toString());
+        this.fields.clear();
+        this.fields.putAll(map);
+    }
+
+    private Set<String> missing(Map<String, Object> map) {
+        Set<String> missing = new HashSet<>();
+        for (String key : requiredFields()) {
+            if (!map.containsKey(key))
+                missing.add(key);
+        }
+        return missing;
+    }
+
+    public int size() {
+        return this.fields.size();
+    }
+
+    public Object get(String key) {
+        return this.fields.get(key);
+    }
+
+    public boolean isValid() {
+        //        return this.missing(this.fields).isEmpty() && this.userID != -1;
+        return missing().length == 0;
+    }
+
+    public String[] missing() {
+        StringBuilder b = new StringBuilder();
+        Set<String> m = missing(this.fields);
+
+        if (m.isEmpty())
+            return new String[0];
+
+        for (String k : m) {
+            b.append(k).append(";");
+        }
+        return b.toString().split(";");
+    }
+
+    public void checkRequired() throws KustvaktException {
+        if (!isValid()) {
+            String[] fields = missing();
+            throw new KustvaktException(StatusCodes.MISSING_ARGUMENTS,
+                    "User data object not valid. Missing fields: " + Arrays
+                            .asList(fields));
+        }
+    }
+
+    public Set<String> keys() {
+        return this.fields.keySet();
+    }
+
+    public Collection<Object> values() {
+        return this.fields.values();
+    }
+
+    public Map<String, Object> fields() {
+        return new HashMap<>(this.fields);
+    }
+
+    public void setData(String data) {
+        Map m = JsonUtils.readSimple(data, Map.class);
+        if (m != null)
+            this.fields.putAll(m);
+    }
+
+    public void update(Userdata other) {
+        if (other != null && this.getClass().equals(other.getClass()))
+            this.fields.putAll(other.fields);
+    }
+
+    public String data() {
+        return JsonUtils.toJSON(this.fields);
+    }
+
+    public void addField(String key, Object value) {
+        this.fields.put(key, value);
+    }
+
+    public void validate(EncryptionIface crypto) throws KustvaktException {
+        this.fields = crypto.validateMap(this.fields);
+    }
+
+    public void readDefaults(Map<String, Object> map) {
+        for (String k : defaultFields()) {
+            Object o = map.get(k);
+            if (o != null)
+                this.fields.put(k, o);
+        }
+    }
+
+    public abstract String[] requiredFields();
+
+    public abstract String[] defaultFields();
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java b/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
new file mode 100644
index 0000000..35cc02b
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
@@ -0,0 +1,65 @@
+package de.ids_mannheim.korap.user;
+
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.config.KustvaktClassLoader;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author hanl
+ * @date 27/01/2016
+ */
+public class UserdataFactory {
+
+    private static final Map<Class<? extends Userdata>, UserDataDbIface> instances = new HashMap<>();
+
+    private UserdataFactory() {
+    }
+
+    public static Class<? extends UserDataDbIface> getClass(
+            Class<? extends Userdata> data) {
+        Set<Class<? extends UserDataDbIface>> c = KustvaktClassLoader
+                .loadSubTypes(UserDataDbIface.class);
+        for (Class<? extends UserDataDbIface> o : c) {
+            Type type = o.getGenericInterfaces()[0];
+            if (type instanceof ParameterizedType) {
+                ParameterizedType ptype = (ParameterizedType) type;
+                Class ctype = (Class) ptype.getActualTypeArguments()[0];
+                if (ctype.equals(data))
+                    return o;
+            }
+        }
+        return null;
+    }
+
+    public static UserDataDbIface getDaoInstance(
+            Class<? extends Userdata> data) throws KustvaktException {
+        if (instances.get(data) == null) {
+            Class<? extends UserDataDbIface> cl = getClass(data);
+            if (BeanConfiguration.hasContext() && cl != null) {
+                try {
+                    Constructor c = cl.getConstructor(PersistenceClient.class);
+                    UserDataDbIface iface = (UserDataDbIface) c.newInstance(
+                            BeanConfiguration.getBeans()
+                                    .getPersistenceClient());
+                    instances.put(data, iface);
+                    return iface;
+                }catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
+                    return null;
+                }
+            }
+            throw new KustvaktException(StatusCodes.NOT_SUPPORTED,
+                    "No database class found for type " + data.getSimpleName());
+        }else
+            return instances.get(data);
+    }
+}
diff --git a/src/main/java/de/ids_mannheim/korap/user/Userdetails2.java b/src/main/java/de/ids_mannheim/korap/user/Userdetails2.java
new file mode 100644
index 0000000..0f40f57
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/Userdetails2.java
@@ -0,0 +1,27 @@
+package de.ids_mannheim.korap.user;
+
+/**
+ * @author hanl
+ * @date 22/01/2016
+ * persistence issue with query request
+ */
+public class Userdetails2 extends Userdata {
+
+    public Userdetails2(Integer userid) {
+        super(userid);
+    }
+
+    @Override
+    public String[] requiredFields() {
+        return new String[] { Attributes.EMAIL, Attributes.ADDRESS,
+                Attributes.LASTNAME, Attributes.FIRSTNAME };
+    }
+
+    @Override
+    public String[] defaultFields() {
+        return new String[] { Attributes.EMAIL, Attributes.ADDRESS,
+                Attributes.LASTNAME, Attributes.FIRSTNAME, Attributes.PHONE,
+                Attributes.COUNTRY, Attributes.INSTITUTION, Attributes.GENDER };
+    }
+
+}
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
index 293da84..1d886ed 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/PiwikFilter.java
@@ -13,9 +13,7 @@
 import de.ids_mannheim.korap.config.BeanConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
-import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.user.UserSettings;
+import de.ids_mannheim.korap.user.*;
 import net.minidev.json.JSONArray;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,11 +37,10 @@
     private static Logger jlog = LoggerFactory.getLogger(PiwikFilter.class);
     public static boolean ENABLED = false;
     private Map<String, String> customVars;
-    private AuthenticationManagerIface securityController;
+    private AuthenticationManagerIface controller;
 
     public PiwikFilter() {
-        securityController = BeanConfiguration.getBeans()
-                .getAuthenticationManager();
+        controller = BeanConfiguration.getBeans().getAuthenticationManager();
         ClientConfig config = new DefaultClientConfig();
         Client client = Client.create(config);
         if (jlog.isDebugEnabled())
@@ -69,8 +66,8 @@
         if (request.getAcceptableLanguages() != null)
             l = request.getAcceptableLanguages().get(0);
         try {
-            service.path("piwik/piwik.php")
-                    .queryParam("idsite", "2").queryParam("rec", "1")
+            service.path("piwik/piwik.php").queryParam("idsite", "2")
+                    .queryParam("rec", "1")
                     //todo check for empty container
                     .queryParam("_cvar", translateCustomData())
                     .queryParam("cip", request.getHeaderValue("Host"))
@@ -116,10 +113,10 @@
                 TokenContext context = (TokenContext) request
                         .getUserPrincipal();
                 // since this is cached, not very expensive!
-                User user = securityController.getUser(context.getUsername());
-                UserSettings settiings = securityController
-                        .getUserSettings(user);
-                if (settiings.isCollectData())
+                User user = controller.getUser(context.getUsername());
+                Userdata data = controller
+                        .getUserData(user, UserSettings2.class);
+                if ((Boolean) data.get(Attributes.COLLECT_AUDITING_DATA))
                     customVars.put("username", context.getUsername());
             }catch (KustvaktException | UnsupportedOperationException e) {
                 //do nothing
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java
index f53c816..86424c5 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/AuthService.java
@@ -7,10 +7,7 @@
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
 import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
-import de.ids_mannheim.korap.user.Attributes;
-import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.user.UserSettings;
+import de.ids_mannheim.korap.user.*;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.utils.KustvaktLogger;
 import de.ids_mannheim.korap.utils.ServiceVersion;
@@ -110,7 +107,7 @@
             // is actual an invalid request
             throw KustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
 
-        Map<String, String> attr = new HashMap<>();
+        Map<String, Object> attr = new HashMap<>();
         if (scopes != null && !scopes.isEmpty())
             attr.put(Attributes.SCOPES, scopes);
         attr.put(Attributes.HOST, host);
@@ -118,7 +115,10 @@
         TokenContext context;
         try {
             User user = controller.authenticate(0, values[0], values[1], attr);
-            this.controller.getUserDetails(user);
+            Userdata data = this.controller
+                    .getUserData(user, Userdetails2.class);
+            // todo: is this necessary?
+//            attr.putAll(data.fields());
             context = controller.createTokenContext(user, attr,
                     Attributes.API_AUTHENTICATION);
         }catch (KustvaktException e) {
@@ -175,7 +175,7 @@
                 .equalsIgnoreCase("null"))
             throw KustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
 
-        Map<String, String> attr = new HashMap<>();
+        Map<String, Object> attr = new HashMap<>();
         attr.put(Attributes.HOST, host);
         attr.put(Attributes.USER_AGENT, agent);
         TokenContext context;
@@ -204,7 +204,7 @@
         // the shibfilter decrypted the values
         // define default provider for returned access token strategy?!
 
-        Map<String, String> attr = new HashMap<>();
+        Map<String, Object> attr = new HashMap<>();
         attr.put(Attributes.HOST, host);
         attr.put(Attributes.USER_AGENT, agent);
 
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
index 11fc0b3..c516364 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/OAuthService.java
@@ -8,9 +8,7 @@
 import de.ids_mannheim.korap.handlers.OAuth2Handler;
 import de.ids_mannheim.korap.interfaces.AuthenticationManagerIface;
 import de.ids_mannheim.korap.interfaces.EncryptionIface;
-import de.ids_mannheim.korap.user.Attributes;
-import de.ids_mannheim.korap.user.TokenContext;
-import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.*;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.utils.StringUtils;
 import de.ids_mannheim.korap.web.KustvaktServer;
@@ -124,10 +122,12 @@
     public Response getStatus(@Context SecurityContext context,
             @QueryParam("scope") String scopes) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
-        User user;
+        Map<String, Object> details;
         try {
-            user = this.controller.getUser(ctx.getUsername());
-            this.controller.getUserDetails(user);
+            User user = this.controller.getUser(ctx.getUsername());
+            Userdata data = this.controller
+                    .getUserData(user, Userdetails2.class);
+            details = data.fields();
             Set<String> base_scope = StringUtils.toSet(scopes, " ");
             base_scope.retainAll(StringUtils.toSet(scopes));
             scopes = StringUtils.toString(base_scope);
@@ -136,8 +136,8 @@
         }
         // json format with scope callback parameter
         // todo: add other scopes as well!
-        return Response.ok(JsonUtils.toJSON(Scopes
-                .mapScopes(scopes, user.getDetails()))).build();
+        return Response.ok(JsonUtils
+                .toJSON(Scopes.mapScopes(scopes, details))).build();
     }
 
     @GET
@@ -172,7 +172,7 @@
             @Context SecurityContext context,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
-            MultivaluedMap<String, String> form)
+            MultivaluedMap<String, Object> form)
             throws OAuthSystemException, URISyntaxException {
         // user needs to be authenticated to this service!
         TokenContext c = (TokenContext) context.getUserPrincipal();
@@ -184,7 +184,7 @@
                     new MD5Generator());
             User user;
 
-            Map<String, String> attr = new HashMap<>();
+            Map<String, Object> attr = new HashMap<>();
             attr.put(Attributes.HOST, host);
             attr.put(Attributes.USER_AGENT, agent);
             attr.put(Attributes.USERNAME, c.getUsername());
@@ -198,7 +198,9 @@
 
             try {
                 user = controller.getUser(c.getUsername());
-                controller.getUserDetails(user);
+                Userdata data = controller
+                        .getUserData(user, Userdetails2.class);
+                user.addUserData(data);
             }catch (KustvaktException e) {
                 throw KustvaktResponseHandler.throwit(e);
             }
@@ -436,7 +438,7 @@
                         .entity(res.getBody()).build();
             }
 
-            Map<String, String> attr = new HashMap<>();
+            Map<String, Object> attr = new HashMap<>();
             attr.put(Attributes.HOST, host);
             attr.put(Attributes.USER_AGENT, agent);
             attr.put(Attributes.SCOPES,
@@ -540,7 +542,10 @@
                         user = controller
                                 .authenticate(0, oauthRequest.getUsername(),
                                         oauthRequest.getPassword(), attr);
-                    controller.getUserDetails(user);
+                    Userdata data = controller
+                            .getUserData(user, Userdetails2.class);
+                    user.addUserData(data);
+
                     attr.put(Attributes.CLIENT_SECRET,
                             oauthRequest.getClientSecret());
                     TokenContext c = controller.createTokenContext(user, attr,
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
index 7bb87e7..7a6b249 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/ResourceService.java
@@ -669,7 +669,7 @@
             //todo ?!
             CollectionQueryBuilder3 query = new CollectionQueryBuilder3();
             if (resource instanceof VirtualCollection) {
-                query.setBaseQuery((String) resource.getData());
+                query.setBaseQuery(resource.getData());
             }else if (resource instanceof Corpus) {
                 query.addQuery("corpusID=" + resource.getName());
             }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
index d76d02f..03b19bc 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
@@ -59,27 +59,20 @@
     public Response signUp(
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
-            @Context Locale locale,
-            MultivaluedMap<String, String> form_values) {
-        Map<String, String> wrapper = FormRequestWrapper
+            @Context Locale locale, MultivaluedMap form_values) {
+        Map<String, Object> wrapper = FormRequestWrapper
                 .toMap(form_values, true);
 
         wrapper.put(Attributes.HOST, host);
         wrapper.put(Attributes.USER_AGENT, agent);
         UriBuilder uriBuilder;
         User user;
-        if (wrapper.get(Attributes.EMAIL) == null)
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.ILLEGAL_ARGUMENT, "parameter missing",
-                            "email");
-
         try {
             uriBuilder = info.getBaseUriBuilder();
             uriBuilder.path(KustvaktServer.API_VERSION).path("user")
                     .path("confirm");
 
             user = controller.createUserAccount(wrapper, true);
-
         }catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
@@ -217,18 +210,19 @@
     public Response getStatus(@Context SecurityContext context,
             @QueryParam("scopes") String scopes) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
-        User user;
+        Scopes m;
         try {
-            user = controller.getUser(ctx.getUsername());
-            controller.getUserDetails(user);
+            User user = controller.getUser(ctx.getUsername());
+            Userdata data = controller.getUserData(user, Userdetails2.class);
+
             Set<String> base_scope = StringUtils.toSet(scopes, " ");
             if (scopes != null)
                 base_scope.retainAll(StringUtils.toSet(scopes));
             scopes = StringUtils.toString(base_scope);
+            m = Scopes.mapScopes(scopes, data.fields());
         }catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
-        Scopes m = Scopes.mapScopes(scopes, user.getDetails());
         return Response.ok(m.toEntity()).build();
     }
 
@@ -239,19 +233,17 @@
     public Response getUserSettings(@Context SecurityContext context,
             @Context Locale locale) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
-        User user;
+        String result;
         try {
-            user = controller.getUser(ctx.getUsername());
-            controller.getUserSettings(user);
-
+            User user = controller.getUser(ctx.getUsername());
+            Userdata data = controller.getUserData(user, UserSettings2.class);
+            data.addField(Attributes.USERNAME, ctx.getUsername());
+            result = data.data();
         }catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
-
-        Map m = user.getSettings().toObjectMap();
-        m.put(Attributes.USERNAME, ctx.getUsername());
-        return Response.ok(JsonUtils.toJSON(m)).build();
+        return Response.ok(result).build();
     }
 
     // todo: test
@@ -261,24 +253,27 @@
     @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
             PiwikFilter.class })
     public Response updateSettings(@Context SecurityContext context,
-            @Context Locale locale, MultivaluedMap<String, String> form) {
+            @Context Locale locale, MultivaluedMap form) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
-        Map<String, String> settings = FormRequestWrapper.toMap(form, false);
+        Map<String, Object> settings = FormRequestWrapper.toMap(form, false);
 
         try {
             User user = controller.getUser(ctx.getUsername());
-            UserSettings us = controller.getUserSettings(user);
+            if (user.isDemo())
+                return Response.notModified().build();
+
+            Userdata data = controller.getUserData(user, UserSettings2.class);
             // todo: check setting only within the scope of user settings permissions; not foundry range. Latter is part of
             // frontend which only displays available foundries and
             //            SecurityManager.findbyId(us.getDefaultConstfoundry(), user, Foundry.class);
             //            SecurityManager.findbyId(us.getDefaultLemmafoundry(), user, Foundry.class);
             //            SecurityManager.findbyId(us.getDefaultPOSfoundry(), user, Foundry.class);
             //            SecurityManager.findbyId(us.getDefaultRelfoundry(), user, Foundry.class);
-            us.updateStringSettings(settings);
+            Userdata new_data = new UserSettings2(user.getId());
+            new_data.setData(JsonUtils.toJSON(settings));
+            data.update(new_data);
 
-            controller.updateUserSettings(user, us);
-            if (user.isDemo())
-                return Response.notModified().build();
+            controller.updateUserData(data);
         }catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
@@ -294,18 +289,17 @@
     public Response getDetails(@Context SecurityContext context,
             @Context Locale locale) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
-        User user;
+        String result;
         try {
-            user = controller.getUser(ctx.getUsername());
-            controller.getUserDetails(user);
+            User user = controller.getUser(ctx.getUsername());
+            Userdata data = controller.getUserData(user, Userdetails2.class);
+            data.addField(Attributes.USERNAME, ctx.getUsername());
+            result = data.data();
         }catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
-
-        Map m = user.getDetails().toMap();
-        m.put(Attributes.USERNAME, ctx.getUsername());
-        return Response.ok(JsonUtils.toJSON(m)).build();
+        return Response.ok(result).build();
     }
 
     @POST
@@ -317,15 +311,19 @@
             @Context Locale locale, MultivaluedMap form) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
 
-        Map<String, String> wrapper = FormRequestWrapper.toMap(form, true);
+        Map<String, Object> wrapper = FormRequestWrapper.toMap(form, true);
 
         try {
             User user = controller.getUser(ctx.getUsername());
-            UserDetails det = controller.getUserDetails(user);
-            det.updateDetails(wrapper);
-            controller.updateUserDetails(user, det);
             if (user.isDemo())
                 return Response.notModified().build();
+
+            Userdetails2 new_data = new Userdetails2(user.getId());
+            new_data.setData(JsonUtils.toJSON(wrapper));
+
+            Userdetails2 det = controller.getUserData(user, Userdetails2.class);
+            det.update(new_data);
+            controller.updateUserData(det);
         }catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java b/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java
index b688ab0..f486b1b 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/FormRequestWrapper.java
@@ -16,7 +16,7 @@
  */
 public class FormRequestWrapper extends HttpServletRequestWrapper {
 
-    private MultivaluedMap<String, String> form;
+    private MultivaluedMap<String, Object> form;
 
     /**
      * Constructs a request object wrapping the given request.
@@ -25,7 +25,7 @@
      * @throws IllegalArgumentException if the request is null
      */
     public FormRequestWrapper(HttpServletRequest request,
-            MultivaluedMap<String, String> form) {
+            MultivaluedMap<String, Object> form) {
         super(request);
         this.form = form;
     }
@@ -48,7 +48,7 @@
         return values;
     }
 
-    public Map<String, String> singleValueMap() {
+    public Map<String, Object> singleValueMap() {
         return toMap(this.form, false);
     }
 
@@ -57,9 +57,9 @@
      *               in value list and returns the result
      * @return key/value map
      */
-    public static Map<String, String> toMap(MultivaluedMap<String, String> form,
+    public static Map<String, Object> toMap(MultivaluedMap<String, Object> form,
             boolean strict) {
-        HashMap<String, String> map = new HashMap<>();
+        HashMap<String, Object> map = new HashMap<>();
         for (String key : form.keySet()) {
             if (strict && form.get(key).size() > 1)
                 continue;
@@ -74,7 +74,7 @@
     }
 
     public void put(String key, String... values) {
-        this.form.put(key, Arrays.<String>asList(values));
+        this.form.put(key, Arrays.<Object>asList(values));
     }
 
 }
diff --git a/src/main/resources/db/sqlite/V1__Initial_version.sql b/src/main/resources/db/sqlite/V1__Initial_version.sql
index edbf4ee..c26fce3 100644
--- a/src/main/resources/db/sqlite/V1__Initial_version.sql
+++ b/src/main/resources/db/sqlite/V1__Initial_version.sql
@@ -65,6 +65,18 @@
 on delete cascade
 );
 
+CREATE TABLE IF NOT EXISTS user_details2 (
+id INTEGER PRIMARY KEY AUTOINCREMENT,
+user_id INTEGER UNIQUE NOT NULL,
+data BLOB NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS user_settings2 (
+id INTEGER PRIMARY KEY AUTOINCREMENT,
+user_id INTEGER UNIQUE NOT NULL,
+data BLOB NOT NULL
+);
+
 
 CREATE TABLE IF NOT EXISTS user_queries (
 id INTEGER PRIMARY KEY,
diff --git a/src/test/java/UserdataTest.java b/src/test/java/UserdataTest.java
new file mode 100644
index 0000000..b635ddc
--- /dev/null
+++ b/src/test/java/UserdataTest.java
@@ -0,0 +1,108 @@
+import de.ids_mannheim.korap.config.BeanConfiguration;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.user.*;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 27/01/2016
+ */
+public class UserdataTest {
+
+    @BeforeClass
+    public static void init() {
+        BeanConfiguration.loadClasspathContext("default-config.xml");
+    }
+
+    @AfterClass
+    public static void drop() {
+        BeanConfiguration.closeApplication();
+    }
+
+    @Before
+    public void clear() {
+        UserDetailsDao dao = new UserDetailsDao(
+                BeanConfiguration.getBeans().getPersistenceClient());
+        assert dao.deleteAll() != -1;
+    }
+
+    @Test
+    public void testDataStore() {
+        User user = new KorAPUser();
+        user.setId(1);
+        UserDetailsDao dao = new UserDetailsDao(
+                BeanConfiguration.getBeans().getPersistenceClient());
+        Userdetails2 d = new Userdetails2(1);
+        d.addField("key_1", "value is a value");
+        assert dao.store(d) != -1;
+    }
+
+    @Test
+    public void testDataGet() {
+        User user = new KorAPUser();
+        user.setId(1);
+        UserDetailsDao dao = new UserDetailsDao(
+                BeanConfiguration.getBeans().getPersistenceClient());
+        Userdetails2 d = new Userdetails2(1);
+        d.addField("key_1", "value is a value");
+        assert dao.store(d) != -1;
+
+        d = dao.get(d.getId());
+        assert d != null;
+        assert "value is a value".equals(d.get("key_1"));
+
+        d = dao.get(user);
+        assert d != null;
+        assert "value is a value".equals(d.get("key_1"));
+    }
+
+    @Test
+    public void testDataValidation() {
+        Userdata data = new Userdetails2(1);
+        data.addField(Attributes.COUNTRY, "Germany");
+
+        String[] req = data.requiredFields();
+        String[] r = data.missing();
+        assert r.length > 0;
+        assert r.length == req.length;
+        assert !data.isValid();
+    }
+
+    @Test
+    public void testSettingsValidation() {
+        Userdata data = new UserSettings2(1);
+        data.addField(Attributes.FILE_FORMAT_FOR_EXPORT, "export");
+
+        String[] req = data.requiredFields();
+        String[] r = data.missing();
+        assert r.length == 0;
+        assert r.length == req.length;
+        assert data.isValid();
+    }
+
+    @Test
+    public void testUserdatafactory() throws KustvaktException {
+        UserDataDbIface dao = UserdataFactory
+                .getDaoInstance(Userdetails2.class);
+        assert UserDetailsDao.class.equals(dao.getClass());
+    }
+
+    @Test(expected = KustvaktException.class)
+    public void testUserdatafactoryError() throws KustvaktException {
+        UserdataFactory.getDaoInstance(new Userdata(1) {
+            @Override
+            public String[] requiredFields() {
+                return new String[0];
+            }
+
+            @Override
+            public String[] defaultFields() {
+                return new String[0];
+            }
+        }.getClass());
+    }
+
+}
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
index 739b16d..c96906d 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -33,6 +33,10 @@
             Map m = new HashMap<>();
             m.put(Attributes.USERNAME, credentials[0]);
             m.put(Attributes.PASSWORD, credentials[1]);
+            m.put(Attributes.FIRSTNAME, "test");
+            m.put(Attributes.LASTNAME, "user");
+            m.put(Attributes.EMAIL, "test@ids-mannheim.de");
+            m.put(Attributes.ADDRESS, "Mannheim");
 
             Assert.assertNotNull("userdatabase handler must not be null", dao);
 
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
index 9673bd5..62beae8 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/KustvaktResourceServiceTest.java
@@ -55,7 +55,7 @@
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        System.out.println("COLLECTIONS " + node);
+
         assert node.size() > 0;
     }
 
@@ -69,20 +69,22 @@
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
         assert node != null;
-        System.out.println("JSON NODE RESULT " + node);
+
+        System.out.println("-------------------------------");
+        System.out.println("NODE COLLECTIONS" + node);
         String id = node.path(0).path("id").asText();
 
         response = resource().path(getAPIVersion()).path("collection").path(id)
                 .path("stats").header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
-        System.out.println("----------------------------- testStats 2");
-        System.out.println(response.getEntity(String.class));
+
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
         node = JsonUtils.readTree(response.getEntity(String.class));
         assert node != null;
         int docs = node.path("documents").asInt();
-        System.out.println("THE FINAL NODE : " + node);
+        System.out.println("-------------------------------");
+        System.out.println("NODE " + node);
         assert docs > 0 && docs < 15;
     }
 
