diff --git a/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java b/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
deleted file mode 100644
index 4317bb5..0000000
--- a/src/main/java/de/ids_mannheim/korap/handlers/CollectionDao.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package de.ids_mannheim.korap.handlers;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
-import de.ids_mannheim.korap.interfaces.db.ResourceOperationIface;
-import de.ids_mannheim.korap.resources.KustvaktResource;
-import de.ids_mannheim.korap.resources.VirtualCollection;
-import de.ids_mannheim.korap.user.User;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.dao.DataAccessException;
-import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
-import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-
-/**
- * @author hanl
- * @date 11/01/2014
- */
-
-@Deprecated
-//todo?! cache with ehcache and put token/sentence/paragraph numbers into cache
-public class CollectionDao
-        implements ResourceOperationIface<VirtualCollection> {
-
-    private static Logger log = LoggerFactory.getLogger(CollectionDao.class);
-    private BatchBuilder batchBuilder;
-    protected final NamedParameterJdbcTemplate jdbcTemplate;
-
-    public CollectionDao(PersistenceClient client) {
-        this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
-        this.batchBuilder = new BatchBuilder(
-                this.jdbcTemplate.getJdbcOperations());
-    }
-
-    @Override
-    public Class<VirtualCollection> getType() {
-        return VirtualCollection.class;
-    }
-
-    // fixme: persistentid can be done, persistence is achieved by specifing a date until which documents
-    // are to be included. this excludes documents that are part of the "sperreinträge"
-    public <T extends KustvaktResource> T findbyId(String id, User user)
-            throws KustvaktException {
-        MapSqlParameterSource source = new MapSqlParameterSource();
-        source.addValue("id", id);
-        source.addValue("user", user.getId());
-        final String sql = "select * from coll_store where persistent_id=:id and user_id=:user;";
-        try {
-            return (T) this.jdbcTemplate.queryForObject(sql, source,
-                    new RowMapperFactory.CollectionMapper());
-        }catch (DataAccessException e) {
-            log.error("Exception during database get for id '" + id + "'", e);
-            return null;
-        }
-    }
-
-    public VirtualCollection findbyId(Integer id, User user)
-            throws KustvaktException {
-        MapSqlParameterSource source = new MapSqlParameterSource();
-        source.addValue("id", id);
-        final String sql = "select * from coll_store where id=:id";
-        try {
-            return this.jdbcTemplate.queryForObject(sql, source,
-                    new RowMapperFactory.CollectionMapper());
-        }catch (DataAccessException e) {
-            log.error("Exception during database get for id '" + id + "'", e);
-            return null;
-        }
-    }
-
-    public int updateResource(VirtualCollection resource, User user)
-            throws KustvaktException {
-        MapSqlParameterSource np = new MapSqlParameterSource();
-        np.addValue("id", resource.getPersistentID());
-        np.addValue("qy", resource.getData());
-        np.addValue("name", resource.getName());
-        np.addValue("desc", resource.getDescription());
-        final String sql = "UPDATE coll_store SET query=:qy, name=:name, description=:desc WHERE persistent_id=:id;";
-        try {
-            return this.jdbcTemplate.update(sql, np);
-        }catch (DataAccessException e) {
-            log.error("Exception during database update for id '" + resource
-                    .getPersistentID() + "'", e);
-            throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-    public int[] updateResources(List<VirtualCollection> resources, User user)
-            throws KustvaktException {
-        MapSqlParameterSource[] sources = new MapSqlParameterSource[resources
-                .size()];
-        final String sql = "UPDATE coll_store SET query=:qy, name=:name, description=:desc WHERE persistent_id=:id;";
-        int i = 0;
-        for (VirtualCollection c : resources) {
-            MapSqlParameterSource np = new MapSqlParameterSource();
-            np.addValue("id", c.getPersistentID());
-            np.addValue("qy", c.getData());
-            np.addValue("name", c.getName());
-            np.addValue("desc", c.getDescription());
-            sources[i++] = np;
-        }
-        try {
-            return this.jdbcTemplate.batchUpdate(sql, sources);
-        }catch (DataAccessException e) {
-            log.error("Exception during database update", e);
-            throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-    @Override
-    public int storeResource(VirtualCollection resource, User user)
-            throws KustvaktException {
-        if (resource.getData() != null) {
-            MapSqlParameterSource np = new MapSqlParameterSource();
-            np.addValue("query", resource.getData());
-            np.addValue("pid", resource.getPersistentID());
-            np.addValue("name", resource.getName());
-            np.addValue("desc", resource.getDescription());
-            np.addValue("us", user.getId());
-            np.addValue("cr", System.currentTimeMillis());
-
-            final String sql =
-                    "INSERT INTO coll_store (persistent_id, name, description, user_id, query, created) "
-                            + "VALUES (:pid, :name, :desc, :us, :query, :cr);";
-            try {
-                return this.jdbcTemplate.update(sql, np);
-            }catch (DataAccessException e) {
-                log.error("Exception during database store for id '" + resource
-                        .getPersistentID() + "'", e);
-                throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
-            }
-        }else
-            throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
-                    "invalid query parameter", (String) resource.getData());
-    }
-
-    public int deleteResource(String id, User user) throws KustvaktException {
-        //todo: foreign key and on delete cascade does not work properly!
-        MapSqlParameterSource np = new MapSqlParameterSource();
-        np.addValue("id", id);
-        np.addValue("user", user.getId());
-        //        final String sql = "DELETE FROM coll_store cs inner join r_store rs on rs.id=cs.id WHERE rs.persistent_id=:id;";
-        final String sql = "DELETE FROM coll_store where persistent_id=:id and user_id=:user;";
-        try {
-            return this.jdbcTemplate.update(sql, np);
-        }catch (DataAccessException e) {
-            log.error("Exception during database delete for id '" + id + "'",
-                    e);
-            throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-    @Override
-    public int deleteAll() throws KustvaktException {
-        final String sql = "DELETE FROM coll_store;";
-        try {
-            return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-    @Override
-    public int size() throws KustvaktException {
-        final String sql = "select count(*) from coll_store;";
-        try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, new HashMap<String, Object>(),
-                            Integer.class);
-        }catch (DataAccessException e) {
-            throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
-        }
-    }
-
-    //todo: adjust to resource id input (batch operation!)
-    // fixme: test
-    public List<VirtualCollection> getResources(Collection<Object> resources,
-            User user) throws KustvaktException {
-        final String sql1 = "SELECT * from coll_store where id in";
-        //        final String sql =
-        //                "SELECT rs.*, rt.name_path, cs.query FROM r_store as rs inner join r_tree as rt on rs.id=rt.childID "
-        //                        + "inner join coll_store as cs on cs.id=rs.id WHERE rs.id in";
-        return batchBuilder.selectFromIDs(sql1, resources,
-                new RowMapperFactory.CollectionMapper());
-    }
-
-}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java b/src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java
similarity index 95%
rename from src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
rename to src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java
index 4e16bed..071a74a 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDetailsDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java
@@ -1,6 +1,9 @@
-package de.ids_mannheim.korap.user;
+package de.ids_mannheim.korap.handlers;
 
 import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.Userdetails2;
 import org.springframework.dao.DataAccessException;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettingsDao.java b/src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java
similarity index 95%
rename from src/main/java/de/ids_mannheim/korap/user/UserSettingsDao.java
rename to src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java
index c82ac64..dfc8830 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserSettingsDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java
@@ -1,6 +1,9 @@
-package de.ids_mannheim.korap.user;
+package de.ids_mannheim.korap.handlers;
 
 import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.UserSettings2;
 import org.springframework.dao.DataAccessException;
 import org.springframework.jdbc.core.RowMapper;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java
similarity index 79%
rename from src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
rename to src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java
index 7ee663c..e1812ff 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDataDbIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java
@@ -1,6 +1,8 @@
-package de.ids_mannheim.korap.user;
+package de.ids_mannheim.korap.interfaces.db;
 
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.user.Userdata;
 
 /**
  * @author hanl
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 2eca9e0..e6393e9 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
@@ -9,6 +9,7 @@
 import de.ids_mannheim.korap.interfaces.EncryptionIface;
 import de.ids_mannheim.korap.interfaces.db.AuditingIface;
 import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
 import de.ids_mannheim.korap.user.*;
 import de.ids_mannheim.korap.utils.StringUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
deleted file mode 100644
index 135fbd2..0000000
--- a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package de.ids_mannheim.korap.user;
-
-import lombok.Data;
-import org.apache.commons.collections.map.CaseInsensitiveMap;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * User: hanl
- * Date: 8/14/13
- * Time: 10:32 AM
- */
-
-// todo: set certain fields required!
-@Deprecated
-@Data
-public class UserDetails {
-
-    private Integer Id;
-    private Integer userID;
-    private String firstName;
-    private String lastName;
-    // todo :should be boolean or integer?!
-    private String gender;
-    private String phone;
-    private String institution;
-    private String email;
-    private String address;
-    private String country;
-    @Deprecated
-    private boolean privateUsage;
-
-    public UserDetails() {
-        setFirstName("");
-        setLastName("");
-        setPhone("");
-        setEmail("");
-        setGender("");
-        setAddress("");
-        setCountry("");
-        setInstitution("");
-        setPrivateUsage(true);
-    }
-
-    public static UserDetails newDetailsIterator(Map<String, String> d) {
-        UserDetails details = new UserDetails();
-        Map<String, String> detailMap = new CaseInsensitiveMap(d);
-
-        if (!detailMap.isEmpty()) {
-            details.setFirstName(detailMap.get(Attributes.FIRSTNAME));
-            details.setLastName(detailMap.get(Attributes.LASTNAME));
-            details.setPhone(detailMap.get(Attributes.PHONE));
-            details.setEmail(detailMap.get(Attributes.EMAIL));
-            details.setGender(detailMap.get(Attributes.GENDER));
-            details.setAddress(detailMap.get(Attributes.ADDRESS));
-            details.setCountry(detailMap.get(Attributes.COUNTRY));
-            details.setInstitution(detailMap.get(Attributes.INSTITUTION));
-            details.setPrivateUsage(
-                    detailMap.get(Attributes.PRIVATE_USAGE) == null ?
-                            true :
-                            Boolean.valueOf(
-                                    detailMap.get(Attributes.PRIVATE_USAGE)));
-        }
-        return details;
-    }
-
-    public void updateDetails(Map<String, String> d) {
-        Map<String, Object> detailMap = new CaseInsensitiveMap(d);
-
-        if (!detailMap.isEmpty()) {
-            if (detailMap.containsKey(Attributes.FIRSTNAME))
-                this.setFirstName(
-                        String.valueOf(detailMap.get(Attributes.FIRSTNAME)));
-            if (detailMap.containsKey(Attributes.LASTNAME))
-                this.setLastName(
-                        String.valueOf(detailMap.get(Attributes.LASTNAME)));
-            if (detailMap.containsKey(Attributes.PHONE))
-                this.setPhone(String.valueOf(detailMap.get(Attributes.PHONE)));
-            if (detailMap.containsKey(Attributes.EMAIL))
-                this.setEmail(String.valueOf(detailMap.get(Attributes.EMAIL)));
-            if (detailMap.containsKey(Attributes.GENDER))
-                this.setGender(
-                        String.valueOf(detailMap.get(Attributes.GENDER)));
-            if (detailMap.containsKey(Attributes.ADDRESS))
-                this.setAddress(
-                        String.valueOf(detailMap.get(Attributes.ADDRESS)));
-            if (detailMap.containsKey(Attributes.COUNTRY))
-                this.setCountry(
-                        String.valueOf(detailMap.get(Attributes.COUNTRY)));
-            if (detailMap.containsKey(Attributes.INSTITUTION))
-                this.setInstitution(
-                        String.valueOf(detailMap.get(Attributes.INSTITUTION)));
-            this.setPrivateUsage(Boolean.valueOf(
-                    String.valueOf(detailMap.get(Attributes.PRIVATE_USAGE))));
-        }
-    }
-
-    public Map<String, Object> toMap() {
-        Map<String, Object> details = new HashMap<>();
-        // shouldnt there be a mechanism that prevents the retrieval of all information if no scopes are given?
-        // and if so, are the access_tokens specific to the scopes then?
-        details.put(Attributes.EMAIL, this.email);
-        details.put(Attributes.FIRSTNAME, this.firstName);
-        details.put(Attributes.LASTNAME, this.lastName);
-        details.put(Attributes.GENDER, this.gender);
-        details.put(Attributes.PHONE, this.phone);
-        details.put(Attributes.INSTITUTION, this.institution);
-        details.put(Attributes.ADDRESS, this.address);
-        details.put(Attributes.COUNTRY, this.country);
-        details.put(Attributes.PRIVATE_USAGE, this.privateUsage);
-
-        for (Map.Entry<String, Object> pair : details.entrySet()) {
-            if (pair.getValue() == null || pair.getValue().equals("null"))
-                pair.setValue("");
-        }
-        return details;
-    }
-
-}
-
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
deleted file mode 100644
index 77351e9..0000000
--- a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
+++ /dev/null
@@ -1,525 +0,0 @@
-package de.ids_mannheim.korap.user;
-
-import de.ids_mannheim.korap.utils.BooleanUtils;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * User: hanl
- * Date: 8/14/13
- * Time: 10:26 AM
- */
-
-@Deprecated
-@Getter
-@Setter
-public class UserSettings {
-
-    // todo: use simple map for settings, not all the parameter
-    //todo: --> use sqlbuilder to update settings
-
-
-    private Map<String, Object> values;
-    // those are the only important parameters!!
-//    private Integer id;
-//    private Integer userID;
-
-
-    private Integer id;
-    private Integer userID;
-    private String fileNameForExport;
-    //    @Deprecated
-    //    private Integer itemForSimpleAnnotation;
-    private String leftContextItemForExport;
-    private Integer leftContextSizeForExport;
-    private String locale;
-    private String leftContextItem;
-    private Integer leftContextSize;
-    private String rightContextItem;
-    private String rightContextItemForExport;
-    private Integer rightContextSize;
-    private Integer rightContextSizeForExport;
-    private String selectedCollection;
-    private String queryLanguage;
-    private Integer pageLength;
-    private boolean metadataQueryExpertModus;
-    //    @Deprecated
-    //    private Integer searchSettingsTab;
-    //    @Deprecated
-    //    private Integer selectedGraphType;
-    //    @Deprecated
-    //    private String selectedSortType;
-    //    @Deprecated
-    //    private String selectedViewForSearchResults;
-
-    /**
-     * default values for foundry specification! of structure ff/lay
-     */
-    private String defaultPOSfoundry;
-    private String defaultLemmafoundry;
-    //default foundry for constituent information (syntax trees) --> there is no actual layer for this information
-    private String defaultConstfoundry;
-    private String defaultRelfoundry;
-
-    //todo: refactor to anonymous -- since data is collected either way!
-    private boolean collectData;
-
-    /**
-     * creates an instance of this object with default values, mapped from a database/configuration file
-     */
-    public UserSettings() {
-        setupDefaultSettings();
-    }
-
-    @Deprecated
-    public static UserSettings fromObjectMap(Map<String, Object> m) {
-        UserSettings s = new UserSettings();
-        s.setFileNameForExport((String) m.get(Attributes.FILENAME_FOR_EXPORT));
-        //        s.setItemForSimpleAnnotation(
-        //                (Integer) m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION));
-        s.setLeftContextItemForExport(
-                (String) m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        s.setLeftContextSizeForExport(
-                (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT));
-        s.setLocale((String) m.get(Attributes.LOCALE));
-        s.setLeftContextItem((String) m.get(Attributes.LEFT_CONTEXT_ITEM));
-        s.setLeftContextSize((Integer) m.get(Attributes.LEFT_CONTEXT_SIZE));
-        s.setRightContextItem((String) m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        s.setRightContextItemForExport(
-                (String) m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        s.setRightContextSize((Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE));
-        s.setRightContextSizeForExport(
-                (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT));
-        s.setSelectedCollection((String) m.get(Attributes.SELECTED_COLLECTION));
-        s.setQueryLanguage((String) m.get(Attributes.QUERY_LANGUAGE));
-        s.setPageLength((Integer) m.get(Attributes.PAGE_LENGTH));
-        s.setMetadataQueryExpertModus((Boolean) BooleanUtils
-                .getBoolean(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
-        //        s.setSearchSettingsTab((Integer) m.get(Attributes.SEARCH_SETTINGS_TAB));
-        //        s.setSelectedGraphType((Integer) m.get(Attributes.SELECTED_GRAPH_TYPE));
-        //        s.setSelectedSortType((String) m.get(Attributes.SELECTED_SORT_TYPE));
-        //        s.setSelectedViewForSearchResults(
-        //                (String) m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-        s.setCollectData((Boolean) BooleanUtils
-                .getBoolean(m.get(Attributes.COLLECT_AUDITING_DATA)));
-
-        s.setDefaultConstfoundry(
-                (String) m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        s.setDefaultRelfoundry((String) m.get(Attributes.DEFAULT_REL_FOUNDRY));
-        s.setDefaultPOSfoundry((String) m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        s.setDefaultLemmafoundry(
-                (String) m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-
-        s.setId((Integer) m.get("Id"));
-        s.setUserID((Integer) m.get("userID"));
-        return s;
-    }
-
-    @Deprecated
-    public static UserSettings fromMap(Map<String, String> m) {
-        UserSettings s = new UserSettings();
-        s.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
-        //        s.setItemForSimpleAnnotation(
-        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
-        s.setLeftContextItemForExport(
-                m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        s.setLeftContextSizeForExport(Integer.valueOf(
-                m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
-        s.setLocale(m.get(Attributes.LOCALE));
-        s.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
-        s.setLeftContextSize(
-                Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
-        s.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        s.setRightContextItemForExport(
-                m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        s.setRightContextSize(
-                Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
-        s.setRightContextSizeForExport(Integer.valueOf(
-                m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
-        s.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
-        s.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
-        s.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
-        s.setMetadataQueryExpertModus(
-                Boolean.valueOf(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
-        //        s.setSearchSettingsTab(
-        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
-        //        s.setSelectedGraphType(
-        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
-        //        s.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
-        //        s.setSelectedViewForSearchResults(
-        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-
-        s.setCollectData(
-                Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
-        s.setDefaultConstfoundry(m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        s.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
-        s.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        s.setDefaultLemmafoundry(m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-        return s;
-    }
-
-    public static UserSettings newSettingsIterator(Map<String, String> m) {
-        UserSettings s = new UserSettings();
-        if (m.isEmpty())
-            return s;
-
-        s.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
-        //        s.setItemForSimpleAnnotation(
-        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
-        s.setLeftContextItemForExport(
-                m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        s.setLeftContextSizeForExport(Integer.valueOf(
-                m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
-        s.setLocale(m.get(Attributes.LOCALE));
-        s.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
-        s.setLeftContextSize(
-                Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
-        s.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        s.setRightContextItemForExport(
-                m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        s.setRightContextSize(
-                Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
-        s.setRightContextSizeForExport(Integer.valueOf(
-                m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
-        s.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
-        s.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
-        s.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
-        s.setMetadataQueryExpertModus(
-                Boolean.valueOf(m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
-        //        s.setSearchSettingsTab(
-        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
-        //        s.setSelectedGraphType(
-        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
-        //        s.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
-        //        s.setSelectedViewForSearchResults(
-        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-
-        s.setCollectData(
-                Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
-        s.setDefaultConstfoundry(m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        s.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
-        s.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        s.setDefaultLemmafoundry(m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-        return s;
-    }
-
-    @Deprecated
-    public void updateStringSettings(Map<String, String> m) {
-        if (m.get(Attributes.FILENAME_FOR_EXPORT) != null)
-            this.setFileNameForExport(m.get(Attributes.FILENAME_FOR_EXPORT));
-        //        this.setItemForSimpleAnnotation(
-        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
-        if (m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT) != null)
-            this.setLeftContextItemForExport(
-                    m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        if (m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT) != null)
-            this.setLeftContextSizeForExport(Integer.valueOf(
-                    m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
-        if (m.get(Attributes.LOCALE) != null)
-            this.setLocale(m.get(Attributes.LOCALE));
-        if (m.get(Attributes.LEFT_CONTEXT_ITEM) != null)
-            this.setLeftContextItem(m.get(Attributes.LEFT_CONTEXT_ITEM));
-        if (m.get(Attributes.LEFT_CONTEXT_SIZE) != null)
-            this.setLeftContextSize(
-                    Integer.valueOf(m.get(Attributes.LEFT_CONTEXT_SIZE)));
-        if (m.get(Attributes.RIGHT_CONTEXT_ITEM) != null)
-            this.setRightContextItem(m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        if (m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT) != null)
-            this.setRightContextItemForExport(
-                    m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        if (m.get(Attributes.RIGHT_CONTEXT_SIZE) != null)
-            this.setRightContextSize(
-                    Integer.valueOf(m.get(Attributes.RIGHT_CONTEXT_SIZE)));
-        if (m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT) != null)
-            this.setRightContextSizeForExport(Integer.valueOf(
-                    m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
-        if (m.get(Attributes.SELECTED_COLLECTION) != null)
-            this.setSelectedCollection(m.get(Attributes.SELECTED_COLLECTION));
-        if (m.get(Attributes.QUERY_LANGUAGE) != null)
-            this.setQueryLanguage(m.get(Attributes.QUERY_LANGUAGE));
-        if (m.get(Attributes.PAGE_LENGTH) != null)
-            this.setPageLength(Integer.valueOf(m.get(Attributes.PAGE_LENGTH)));
-        if (m.get(Attributes.METADATA_QUERY_EXPERT_MODUS) != null)
-            this.setMetadataQueryExpertModus(Boolean.valueOf(
-                    m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
-        //        this.setSearchSettingsTab(
-        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
-        //        this.setSelectedGraphType(
-        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
-        //        this.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
-        //        this.setSelectedViewForSearchResults(
-        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-        if (m.get(Attributes.COLLECT_AUDITING_DATA) != null)
-            this.setCollectData(
-                    Boolean.valueOf(m.get(Attributes.COLLECT_AUDITING_DATA)));
-        if (m.get(Attributes.DEFAULT_POS_FOUNDRY) != null)
-            this.setDefaultPOSfoundry(m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        if (m.get(Attributes.DEFAULT_LEMMA_FOUNDRY) != null)
-            this.setDefaultLemmafoundry(
-                    m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-        if (m.get(Attributes.DEFAULT_CONST_FOUNDRY) != null)
-            this.setDefaultConstfoundry(
-                    m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        if (m.get(Attributes.DEFAULT_REL_FOUNDRY) != null)
-            this.setDefaultRelfoundry(m.get(Attributes.DEFAULT_REL_FOUNDRY));
-    }
-
-    @Deprecated
-    public void updateObjectSettings(Map<String, Object> m) {
-        if (m.get(Attributes.FILENAME_FOR_EXPORT) != null)
-            this.setFileNameForExport(
-                    (String) m.get(Attributes.FILENAME_FOR_EXPORT));
-        //        this.setItemForSimpleAnnotation(
-        //                Integer.valueOf(m.get(Attributes.ITEM_FOR_SIMPLE_ANNOTATION)));
-        if (m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT) != null)
-            this.setLeftContextItemForExport(
-                    (String) m.get(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT));
-        if (m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT) != null)
-            this.setLeftContextSizeForExport(Integer.valueOf(
-                    (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT)));
-        if (m.get(Attributes.LOCALE) != null)
-            this.setLocale((String) m.get(Attributes.LOCALE));
-        if (m.get(Attributes.LEFT_CONTEXT_ITEM) != null)
-            this.setLeftContextItem(
-                    (String) m.get(Attributes.LEFT_CONTEXT_ITEM));
-        if (m.get(Attributes.LEFT_CONTEXT_SIZE) != null)
-            this.setLeftContextSize(Integer.valueOf(
-                    (Integer) m.get(Attributes.LEFT_CONTEXT_SIZE)));
-        if (m.get(Attributes.RIGHT_CONTEXT_ITEM) != null)
-            this.setRightContextItem(
-                    (String) m.get(Attributes.RIGHT_CONTEXT_ITEM));
-        if (m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT) != null)
-            this.setRightContextItemForExport(
-                    (String) m.get(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT));
-        if (m.get(Attributes.RIGHT_CONTEXT_SIZE) != null)
-            this.setRightContextSize(Integer.valueOf(
-                    (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE)));
-        if (m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT) != null)
-            this.setRightContextSizeForExport(Integer.valueOf(
-                    (Integer) m.get(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT)));
-        if (m.get(Attributes.SELECTED_COLLECTION) != null)
-            this.setSelectedCollection(
-                    (String) m.get(Attributes.SELECTED_COLLECTION));
-        if (m.get(Attributes.QUERY_LANGUAGE) != null)
-            this.setQueryLanguage((String) m.get(Attributes.QUERY_LANGUAGE));
-        if (m.get(Attributes.PAGE_LENGTH) != null)
-            this.setPageLength((Integer) m.get(Attributes.PAGE_LENGTH));
-        if (m.get(Attributes.METADATA_QUERY_EXPERT_MODUS) != null)
-            this.setMetadataQueryExpertModus(Boolean.valueOf(
-                    (Boolean) m.get(Attributes.METADATA_QUERY_EXPERT_MODUS)));
-        //        this.setSearchSettingsTab(
-        //                Integer.valueOf(m.get(Attributes.SEARCH_SETTINGS_TAB)));
-        //        this.setSelectedGraphType(
-        //                Integer.valueOf(m.get(Attributes.SELECTED_GRAPH_TYPE)));
-        //        this.setSelectedSortType(m.get(Attributes.SELECTED_SORT_TYPE));
-        //        this.setSelectedViewForSearchResults(
-        //                m.get(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS));
-        if (m.get(Attributes.COLLECT_AUDITING_DATA) != null)
-            this.setCollectData(
-                    (Boolean) m.get(Attributes.COLLECT_AUDITING_DATA));
-        if (m.get(Attributes.DEFAULT_POS_FOUNDRY) != null)
-            this.setDefaultPOSfoundry(
-                    (String) m.get(Attributes.DEFAULT_POS_FOUNDRY));
-        if (m.get(Attributes.DEFAULT_LEMMA_FOUNDRY) != null)
-            this.setDefaultLemmafoundry(
-                    (String) m.get(Attributes.DEFAULT_LEMMA_FOUNDRY));
-        if (m.get(Attributes.DEFAULT_CONST_FOUNDRY) != null)
-            this.setDefaultConstfoundry(
-                    (String) m.get(Attributes.DEFAULT_CONST_FOUNDRY));
-        if (m.get(Attributes.DEFAULT_REL_FOUNDRY) != null)
-            this.setDefaultRelfoundry(
-                    (String) m.get(Attributes.DEFAULT_REL_FOUNDRY));
-    }
-
-    //loadSubTypes from configuration?
-    private void setupDefaultSettings() {
-        this.setFileNameForExport("export");
-        //        this.setItemForSimpleAnnotation(0);
-        this.setLocale("de");
-        this.setLeftContextItemForExport("char");
-        this.setLeftContextSizeForExport(100);
-        this.setLeftContextItem("char");
-        this.setLeftContextSize(200);
-        this.setRightContextItem("char");
-        this.setRightContextItemForExport("char");
-        this.setRightContextSize(200);
-        this.setRightContextSizeForExport(100);
-        // persistent id for wikipedia!
-        // fixme: deprecation warning!
-        this.setSelectedCollection(
-                "ZGU0ZTllNTFkYzc3M2VhZmViYzdkYWE2ODI5NDc3NTk4NGQ1YThhOTMwOTNhOWYxNWMwN2M3Y2YyZmE3N2RlNQ==");
-        this.setQueryLanguage("COSMAS2");
-        this.setPageLength(25);
-        this.setMetadataQueryExpertModus(true);
-        //        this.setSearchSettingsTab(0);
-        //        this.setSelectedGraphType(1);
-        //        this.setSelectedSortType("FIFO");
-        //        this.setSelectedViewForSearchResults("KWIC");
-
-        this.setCollectData(true);
-        this.setDefaultConstfoundry("mate");
-        this.setDefaultRelfoundry("mate");
-        this.setDefaultPOSfoundry("tt");
-        this.setDefaultLemmafoundry("tt");
-    }
-
-    public Map toStringMap() {
-        Map<String, String> m = new HashMap<>();
-        m.put(Attributes.FILENAME_FOR_EXPORT, this.getFileNameForExport());
-        //        m.put(Attributes.ITEM_FOR_SIMPLE_ANNOTATION,
-        //                String.valueOf(this.getItemForSimpleAnnotation()));
-        m.put(Attributes.LEFT_CONTEXT_SIZE,
-                String.valueOf(this.getLeftContextSize()));
-        m.put(Attributes.LEFT_CONTEXT_ITEM,
-                String.valueOf(this.getLeftContextItem()));
-        m.put(Attributes.LOCALE, this.getLocale());
-        m.put(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT,
-                String.valueOf(this.getLeftContextSizeForExport()));
-        m.put(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT,
-                String.valueOf(this.getLeftContextItemForExport()));
-        m.put(Attributes.RIGHT_CONTEXT_ITEM,
-                String.valueOf(this.getRightContextItem()));
-        m.put(Attributes.RIGHT_CONTEXT_SIZE,
-                String.valueOf(this.getRightContextSize()));
-        m.put(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT,
-                String.valueOf(this.getRightContextItemForExport()));
-        m.put(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT,
-                String.valueOf(this.getRightContextSizeForExport()));
-        m.put(Attributes.SELECTED_COLLECTION, this.getSelectedCollection());
-        m.put(Attributes.QUERY_LANGUAGE, this.getQueryLanguage());
-        m.put(Attributes.PAGE_LENGTH, String.valueOf(this.getPageLength()));
-        m.put(Attributes.METADATA_QUERY_EXPERT_MODUS,
-                String.valueOf(this.isMetadataQueryExpertModus()));
-        //        m.put(Attributes.SEARCH_SETTINGS_TAB,
-        //                String.valueOf(this.getSearchSettingsTab()));
-        //        m.put(Attributes.SELECTED_GRAPH_TYPE,
-        //                String.valueOf(this.getSelectedGraphType()));
-        //        m.put(Attributes.SELECTED_SORT_TYPE, this.getSelectedSortType());
-        //        m.put(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS,
-        //                this.getSelectedViewForSearchResults());
-        m.put(Attributes.DEFAULT_POS_FOUNDRY, this.getDefaultPOSfoundry());
-        m.put(Attributes.DEFAULT_LEMMA_FOUNDRY, this.getDefaultLemmafoundry());
-        m.put(Attributes.DEFAULT_CONST_FOUNDRY, this.getDefaultConstfoundry());
-        m.put(Attributes.DEFAULT_REL_FOUNDRY, this.getDefaultRelfoundry());
-        m.put(Attributes.COLLECT_AUDITING_DATA,
-                String.valueOf(this.isCollectData()));
-
-        for (Map.Entry pair : m.entrySet()) {
-            if (pair.getValue() == null)
-                pair.setValue("");
-        }
-        return m;
-    }
-
-    public Map toObjectMap() {
-        Map<String, Object> m = new HashMap<>();
-        m.put(Attributes.FILENAME_FOR_EXPORT, this.getFileNameForExport());
-        //        m.put(Attributes.ITEM_FOR_SIMPLE_ANNOTATION,
-        //                this.getItemForSimpleAnnotation());
-        m.put(Attributes.LEFT_CONTEXT_SIZE, this.getLeftContextSize());
-        m.put(Attributes.LEFT_CONTEXT_ITEM, this.getLeftContextItem());
-        m.put(Attributes.LOCALE, this.getLocale());
-        m.put(Attributes.LEFT_CONTEXT_SIZE_FOR_EXPORT,
-                this.getLeftContextSizeForExport());
-        m.put(Attributes.LEFT_CONTEXT_ITEM_FOR_EXPORT,
-                this.getLeftContextItemForExport());
-        m.put(Attributes.RIGHT_CONTEXT_ITEM, this.getRightContextItem());
-        m.put(Attributes.RIGHT_CONTEXT_SIZE, this.getRightContextSize());
-        m.put(Attributes.RIGHT_CONTEXT_ITEM_FOR_EXPORT,
-                this.getRightContextItemForExport());
-        m.put(Attributes.RIGHT_CONTEXT_SIZE_FOR_EXPORT,
-                this.getRightContextSizeForExport());
-        m.put(Attributes.SELECTED_COLLECTION, this.getSelectedCollection());
-        m.put(Attributes.QUERY_LANGUAGE, this.getQueryLanguage());
-        m.put(Attributes.PAGE_LENGTH, this.getPageLength());
-        m.put(Attributes.METADATA_QUERY_EXPERT_MODUS,
-                this.isMetadataQueryExpertModus());
-        //        m.put(Attributes.SEARCH_SETTINGS_TAB, this.getSearchSettingsTab());
-        //        m.put(Attributes.SELECTED_GRAPH_TYPE, this.getSelectedGraphType());
-        //        m.put(Attributes.SELECTED_SORT_TYPE, this.getSelectedSortType());
-        //        m.put(Attributes.SELECTED_VIEW_FOR_SEARCH_RESULTS,
-        //                this.getSelectedViewForSearchResults());
-        m.put(Attributes.DEFAULT_POS_FOUNDRY, this.getDefaultPOSfoundry());
-        m.put(Attributes.DEFAULT_LEMMA_FOUNDRY, this.getDefaultLemmafoundry());
-        m.put(Attributes.DEFAULT_CONST_FOUNDRY, this.getDefaultConstfoundry());
-        m.put(Attributes.DEFAULT_REL_FOUNDRY, this.getDefaultRelfoundry());
-        m.put(Attributes.COLLECT_AUDITING_DATA, this.isCollectData());
-        for (Map.Entry pair : m.entrySet()) {
-            if (pair.getValue() == null)
-                pair.setValue("");
-        }
-        return m;
-    }
-
-    @Override
-    public String toString() {
-        return "UserSettings{" +
-                "id=" + id +
-                ", userid=" + userID +
-                ", fileNameForExport='" + fileNameForExport + '\'' +
-                ", leftContextItemForExport='" + leftContextItemForExport + '\''
-                +
-                ", leftContextSizeForExport=" + leftContextSizeForExport +
-                ", locale='" + locale + '\'' +
-                ", leftContextItem='" + leftContextItem + '\'' +
-                ", leftContextSize=" + leftContextSize +
-                ", rightContextItem='" + rightContextItem + '\'' +
-                ", rightContextItemForExport='" + rightContextItemForExport
-                + '\'' +
-                ", rightContextSize=" + rightContextSize +
-                ", rightContextSizeForExport=" + rightContextSizeForExport +
-                ", selectedCollection='" + selectedCollection + '\'' +
-                ", queryLanguage='" + queryLanguage + '\'' +
-                ", pageLength=" + pageLength +
-                ", metadataQueryExpertModus=" + metadataQueryExpertModus +
-                ", defaultPOSfoundry='" + defaultPOSfoundry + '\'' +
-                ", defaultLemmafoundry='" + defaultLemmafoundry + '\'' +
-                ", defaultConstfoundry='" + defaultConstfoundry + '\'' +
-                ", defaultRelfoundry='" + defaultRelfoundry + '\'' +
-                ", collectData='" + collectData + "\'" +
-                '}';
-    }
-
-    public static UserSettings fromString(String value) {
-        Map<String, Object> map;
-        try {
-            map = JsonUtils.read(value, Map.class);
-        }catch (IOException e) {
-            return new UserSettings();
-        }
-        return UserSettings.fromObjectMap(map);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o)
-            return true;
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        UserSettings that = (UserSettings) o;
-
-        if (userID != null ? userID != that.userID : that.userID != null)
-            return false;
-        if (id != null ? !id.equals(that.id) : that.id != null)
-            return false;
-
-        return true;
-    }
-
-    @Override
-    public int hashCode() {
-        int result = id != null ? id.hashCode() : 0;
-        result = 31 * result + (userID != null ? userID.hashCode() : 0);
-        return result;
-    }
-
-    public String toJSON() {
-        return JsonUtils.toJSON(this);
-    }
-}
diff --git a/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java b/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
index 35cc02b..353915f 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
@@ -5,6 +5,7 @@
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.interfaces.db.PersistenceClient;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
diff --git a/src/test/java/UserdataTest.java b/src/test/java/UserdataTest.java
index b635ddc..1acd921 100644
--- a/src/test/java/UserdataTest.java
+++ b/src/test/java/UserdataTest.java
@@ -1,5 +1,7 @@
 import de.ids_mannheim.korap.config.BeanConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.handlers.UserDetailsDao;
+import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
 import de.ids_mannheim.korap.user.*;
 import org.junit.AfterClass;
 import org.junit.Before;
