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 a6cf827..7c0b418 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
@@ -63,15 +63,19 @@
 
     public abstract void updateUserData(Userdata data) throws KustvaktException;
 
+    @Deprecated
     public abstract UserDetails getUserDetails(User user)
             throws KustvaktException;
 
+    @Deprecated
     public abstract UserSettings getUserSettings(User user)
             throws KustvaktException;
 
+    @Deprecated
     public abstract void updateUserDetails(User user, UserDetails details)
             throws KustvaktException;
 
+    @Deprecated
     public abstract void updateUserSettings(User user, UserSettings settings)
             throws KustvaktException;
 
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 8cd65eb..73eecd1 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
@@ -708,8 +708,6 @@
         dao.update(data);
     }
 
-    // todo: use getuserdata for that!
-    @Deprecated
     public UserDetails getUserDetails(User user) throws KustvaktException {
         try {
             for (Userdata data : user.getUserdata()) {
@@ -725,7 +723,6 @@
         return user.getDetails();
     }
 
-    @Deprecated
     public UserSettings getUserSettings(User user) throws KustvaktException {
         try {
             if (user.getSettings() == null)
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java b/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
index 6d4e2a1..2d2f231 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
@@ -6,8 +6,6 @@
  */
 public interface UserDataDbIface<T extends Userdata> {
 
-    public Class<? extends Userdata> getType();
-
     public int store(T data);
 
     public int update(T data);
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java b/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
index 0bd204d..4e16bed 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
@@ -24,11 +24,6 @@
     }
 
     @Override
-    public Class<Userdetails2> getType() {
-        return Userdetails2.class;
-    }
-
-    @Override
     public int store(Userdetails2 data) {
         String sql = "INSERT INTO user_details2 (user_id, data) VALUES (:userid, :data);";
         MapSqlParameterSource source = new MapSqlParameterSource();
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..6e87a53
--- /dev/null
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettings2.java
@@ -0,0 +1,18 @@
+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];
+    }
+}
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..5af93e7
--- /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_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(UserSettings2 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 UserSettings2 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<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_details2 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_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/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/UserService.java b/src/main/java/de/ids_mannheim/korap/web/service/full/UserService.java
index b342e84..3d8e0e4 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
@@ -220,8 +220,7 @@
         User user;
         try {
             user = controller.getUser(ctx.getUsername());
-            Userdata data = controller
-                    .getUserData(user, Userdetails2.class);
+            Userdata data = controller.getUserData(user, Userdetails2.class);
             user.addUserData(data);
 
             Set<String> base_scope = StringUtils.toSet(scopes, " ");
@@ -242,19 +241,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
@@ -270,18 +267,21 @@
 
         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);
@@ -300,8 +300,7 @@
         User user;
         try {
             user = controller.getUser(ctx.getUsername());
-            Userdata data = controller
-                    .getUserData(user, Userdetails2.class);
+            Userdata data = controller.getUserData(user, Userdetails2.class);
             user.addUserData(data);
 
         }catch (KustvaktException e) {
@@ -327,11 +326,15 @@
 
         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);
