formatter plugin
diff --git a/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java b/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java
index 8e7169c..c2e0791 100644
--- a/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java
+++ b/src/main/java/de/ids_mannheim/korap/auditing/AuditRecord.java
@@ -13,7 +13,8 @@
 /**
  * @author hanl
  *         <p/>
- *         Record holder for auditing requests. Holds the data until it can be persisted to a database
+ *         Record holder for auditing requests. Holds the data until
+ *         it can be persisted to a database
  */
 @Getter
 @Setter
@@ -43,16 +44,19 @@
     private String args;
     private String field_1 = "None";
 
-    private AuditRecord() {
+
+    private AuditRecord () {
         this.timestamp = TimeUtils.getNow().getMillis();
     }
 
-    public AuditRecord(CATEGORY category) {
+
+    public AuditRecord (CATEGORY category) {
         this();
         this.category = category;
     }
 
-    public AuditRecord(CATEGORY cat, Object userID, Integer status) {
+
+    public AuditRecord (CATEGORY cat, Object userID, Integer status) {
         this(cat);
         this.status = status;
         if (userID != null) {
@@ -61,14 +65,16 @@
             //                    user.getTokenContext().getUserAgent());
             this.loc = clientInfoToString("null", "null");
             userid = String.valueOf(userID);
-        }else {
+        }
+        else {
             this.loc = clientInfoToString("null", "null");
             userid = "-1";
         }
     }
 
-    public static AuditRecord serviceRecord(Object user, Integer status,
-            String... args) {
+
+    public static AuditRecord serviceRecord (Object user, Integer status,
+            String ... args) {
         AuditRecord r = new AuditRecord(CATEGORY.SERVICE);
         r.setArgs(Arrays.asList(args).toString());
         r.setUserid(String.valueOf(user));
@@ -76,8 +82,9 @@
         return r;
     }
 
-    public static AuditRecord dbRecord(Object user, Integer status,
-            String... args) {
+
+    public static AuditRecord dbRecord (Object user, Integer status,
+            String ... args) {
         AuditRecord r = new AuditRecord(CATEGORY.DATABASE);
         r.setArgs(Arrays.asList(args).toString());
         r.setUserid(String.valueOf(user));
@@ -85,7 +92,8 @@
         return r;
     }
 
-    public AuditRecord fromJson(String json) {
+
+    public AuditRecord fromJson (String json) {
         JsonNode n = JsonUtils.readTree(json);
         AuditRecord r = new AuditRecord();
         r.setCategory(CATEGORY.valueOf(n.path("category").asText()));
@@ -97,13 +105,15 @@
         return r;
     }
 
-    private String clientInfoToString(String IP, String userAgent) {
+
+    private String clientInfoToString (String IP, String userAgent) {
         return userAgent + "@" + IP;
     }
 
+
     // fixme: add id, useragent
     @Override
-    public String toString() {
+    public String toString () {
         StringBuilder b = new StringBuilder();
         b.append(category.toString().toLowerCase() + " audit : ")
                 .append(userid + "@" + new Date(timestamp)).append("\n")
@@ -116,8 +126,9 @@
         return b.toString();
     }
 
+
     @Override
-    public boolean equals(Object o) {
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (o == null || getClass() != o.getClass())
@@ -131,24 +142,23 @@
             return false;
         if (status != null ? !status.equals(that.status) : that.status != null)
             return false;
-        if (field_1 != null ?
-                !field_1.equals(that.field_1) :
-                that.field_1 != null)
+        if (field_1 != null ? !field_1.equals(that.field_1)
+                : that.field_1 != null)
             return false;
         if (loc != null ? !loc.equals(that.loc) : that.loc != null)
             return false;
         if (target != null ? !target.equals(that.target) : that.target != null)
             return false;
-        if (timestamp != null ?
-                !timestamp.equals(that.timestamp) :
-                that.timestamp != null)
+        if (timestamp != null ? !timestamp.equals(that.timestamp)
+                : that.timestamp != null)
             return false;
 
         return true;
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         int result = userid != null ? userid.hashCode() : 0;
         result = 31 * result + (target != null ? target.hashCode() : 0);
         result = 31 * result + category.hashCode();
diff --git a/src/main/java/de/ids_mannheim/korap/config/AuthCodeInfo.java b/src/main/java/de/ids_mannheim/korap/config/AuthCodeInfo.java
index 28b53ae..03c22d5 100644
--- a/src/main/java/de/ids_mannheim/korap/config/AuthCodeInfo.java
+++ b/src/main/java/de/ids_mannheim/korap/config/AuthCodeInfo.java
@@ -6,9 +6,9 @@
 import java.util.List;
 
 /**
-* @author hanl
-* @date 13/05/2015
-*/
+ * @author hanl
+ * @date 13/05/2015
+ */
 @Data
 public class AuthCodeInfo {
     private String clientId;
@@ -18,12 +18,14 @@
     private String code;
     private List<String> tokens;
 
-    public AuthCodeInfo() {
+
+    public AuthCodeInfo () {
         this.setStatus(true);
         this.tokens = new ArrayList<>();
     }
 
-    public AuthCodeInfo(String clientid, String authcode) {
+
+    public AuthCodeInfo (String clientid, String authcode) {
         this();
         this.clientId = clientid;
         this.code = authcode;
diff --git a/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java
index a9df16b..b09140e 100644
--- a/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java
+++ b/src/main/java/de/ids_mannheim/korap/config/BeanConfiguration.java
@@ -36,42 +36,49 @@
 
     private static BeanHolderHelper beans;
 
+
     //todo: allow this for external plugin systems that are not kustvakt specific
     @Deprecated
-    public static void setCustomBeansHolder(BeanHolderHelper holder) {
+    public static void setCustomBeansHolder (BeanHolderHelper holder) {
         ApplicationContext context = beans.context;
         holder.context = context;
         BeanConfiguration.beans = holder;
     }
 
-    public static BeanHolderHelper getBeans() {
+
+    public static BeanHolderHelper getBeans () {
         return BeanConfiguration.beans;
     }
 
+
     @Deprecated
-    public static void loadAuthenticationProviders() {
+    public static void loadAuthenticationProviders () {
         Set<Class<? extends AuthenticationIface>> set = KustvaktClassLoader
                 .loadSubTypes(AuthenticationIface.class);
         Set<AuthenticationIface> set2 = new HashSet<>();
         for (Class<? extends AuthenticationIface> i : set) {
             try {
                 set2.add(i.newInstance());
-            }catch (InstantiationException | IllegalAccessException e) {
+            }
+            catch (InstantiationException | IllegalAccessException e) {
                 e.printStackTrace();
             }
         }
         try {
             getBeans().getAuthenticationManager().setProviders(set2);
-        }catch (RuntimeException e) {
+        }
+        catch (RuntimeException e) {
             // do nothing
         }
     }
 
-    public static boolean hasContext() {
+
+    public static boolean hasContext () {
         return beans != null && beans.context != null;
     }
 
-    public static void loadClasspathContext(String... files) {
+
+    public static void loadClasspathContext (String ... files) {
         if (hasContext())
             closeApplication();
 
@@ -85,7 +92,8 @@
 
     }
 
-    public static void loadFileContext(String filepath) {
+
+    public static void loadFileContext (String filepath) {
         if (!hasContext()) {
             ApplicationContext context = new FileSystemXmlApplicationContext(
                     "file:" + filepath);
@@ -93,15 +101,17 @@
         }
     }
 
-    public static void closeApplication() {
+
+    public static void closeApplication () {
         if (hasContext())
             beans.finish();
         beans = null;
     }
 
+
     //todo: set response handler
     @Deprecated
-    public static KustvaktResponseHandler getResponseHandler() {
+    public static KustvaktResponseHandler getResponseHandler () {
         return null;
     }
 
@@ -110,78 +120,94 @@
         private ApplicationContext context = null;
         private DefaultHandler handler;
 
-        private BeanHolderHelper(ApplicationContext context) {
+
+        private BeanHolderHelper (ApplicationContext context) {
             this.handler = new DefaultHandler();
             this.context = context;
             // todo: better method?!
             KustvaktResponseHandler.init(getAuditingProvider());
         }
 
-        protected <T> T getBean(Class<T> clazz) {
+
+        protected <T> T getBean (Class<T> clazz) {
             if (context != null) {
                 try {
                     return context.getBean(clazz);
-                }catch (NoSuchBeanDefinitionException e) {
+                }
+                catch (NoSuchBeanDefinitionException e) {
                     // do nothing
                 }
             }
             return this.handler.getDefault(clazz);
         }
 
-        protected <T> T getBean(String name) {
+
+        protected <T> T getBean (String name) {
             if (context != null) {
                 try {
                     return (T) context.getBean(name);
-                }catch (NoSuchBeanDefinitionException e) {
+                }
+                catch (NoSuchBeanDefinitionException e) {
                     // do nothing
                 }
             }
             return (T) this.handler.getDefault(name);
         }
 
-        public AuditingIface getAuditingProvider() {
+
+        public AuditingIface getAuditingProvider () {
             return (AuditingIface) getBean(KUSTVAKT_AUDITING);
         }
 
-        public <T extends KustvaktConfiguration> T getConfiguration() {
+
+        public <T extends KustvaktConfiguration> T getConfiguration () {
             return (T) getBean(KUSTVAKT_CONFIG);
         }
 
-        public PersistenceClient getPersistenceClient() {
+
+        public PersistenceClient getPersistenceClient () {
             return getBean(KUSTVAKT_DB);
         }
 
-        public UserDataDbIface getUserDetailsDao() {
+
+        public UserDataDbIface getUserDetailsDao () {
             return getBean(KUSTVAKT_USERDETAILS);
         }
 
-        public UserDataDbIface getUserSettingsDao() {
+
+        public UserDataDbIface getUserSettingsDao () {
             return getBean(KUSTVAKT_USERSETTINGS);
         }
 
-        public EncryptionIface getEncryption() {
+
+        public EncryptionIface getEncryption () {
             return getBean(KUSTVAKT_ENCRYPTION);
         }
 
-        public AuthenticationManagerIface getAuthenticationManager() {
+
+        public AuthenticationManagerIface getAuthenticationManager () {
             return getBean(KUSTVAKT_AUTHENTICATION_MANAGER);
         }
 
-        public EntityHandlerIface getUserDBHandler() {
+
+        public EntityHandlerIface getUserDBHandler () {
             return getBean(KUSTVAKT_USERDB);
         }
 
-        public PolicyHandlerIface getPolicyDbProvider() {
+
+        public PolicyHandlerIface getPolicyDbProvider () {
             return getBean(KUSTVAKT_POLICIES);
         }
 
+
         // todo: !!!!!!!!!!!!!!!!!!!!!!!!!!
         // todo: more specific --> collection provider, document provider, etc.
-        public ResourceOperationIface getResourceProvider() {
+        public ResourceOperationIface getResourceProvider () {
             return getBean("resourceProvider");
         }
 
-        private void finish() {
+
+        private void finish () {
             this.getAuditingProvider().finish();
             context = null;
         }
diff --git a/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java b/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java
index b2ea511..6e79890 100644
--- a/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/config/BeansFactory.java
@@ -24,89 +24,98 @@
 
     private static ContextHolder beanHolder;
 
+
     //todo: allow this for external plugin systems that are not kustvakt specific
     @Deprecated
-    public static void setCustomBeansHolder(ContextHolder holder) {
+    public static void setCustomBeansHolder (ContextHolder holder) {
         beanHolder = holder;
     }
 
-    public static synchronized ContextHolder getKustvaktContext() {
+
+    public static synchronized ContextHolder getKustvaktContext () {
         return beanHolder;
     }
 
-    public static synchronized ContextHolder getKustvaktContext(int i) {
+
+    public static synchronized ContextHolder getKustvaktContext (int i) {
         return beanHolder;
     }
 
-    public static synchronized TypeBeanFactory getTypeFactory() {
+
+    public static synchronized TypeBeanFactory getTypeFactory () {
         return new TypeBeanFactory(beanHolder);
     }
 
-    public static int loadClasspathContext(String... files) {
+
+    public static int loadClasspathContext (String ... files) {
         ApplicationContext context;
         if (files.length == 0)
             context = new ClassPathXmlApplicationContext(CONFIG_FILE);
         else
             context = new ClassPathXmlApplicationContext(files);
-        ContextHolder h = new ContextHolder(context) {
-        };
+        ContextHolder h = new ContextHolder(context) {};
         BeansFactory.beanHolder = h;
         //        return BeansFactory.beanHolder.indexOf(h);
         return 0;
     }
 
-    public static synchronized int addApplicationContext(
+
+    public static synchronized int addApplicationContext (
             ApplicationContext context) {
-        ContextHolder h = new ContextHolder(context) {
-        };
+        ContextHolder h = new ContextHolder(context) {};
         BeansFactory.beanHolder = h;
         //        return BeansFactory.beanHolder.indexOf(h);
         return 0;
     }
 
-    public static synchronized void setKustvaktContext(ContextHolder holder) {
+
+    public static synchronized void setKustvaktContext (ContextHolder holder) {
         BeansFactory.beanHolder = holder;
     }
 
-    public static synchronized int setApplicationContext(
+
+    public static synchronized int setApplicationContext (
             ApplicationContext context) {
-        ContextHolder h = new ContextHolder(context) {
-        };
+        ContextHolder h = new ContextHolder(context) {};
         BeansFactory.beanHolder = h;
         return 0;
     }
 
-    public static synchronized int loadFileContext(String filepath) {
+
+    public static synchronized int loadFileContext (String filepath) {
         ApplicationContext context = new FileSystemXmlApplicationContext(
                 "file:" + filepath);
-        ContextHolder h = new ContextHolder(context) {
-        };
+        ContextHolder h = new ContextHolder(context) {};
         BeansFactory.beanHolder = h;
         return 0;
     }
 
-    public static void closeApplication() {
+
+    public static void closeApplication () {
         BeansFactory.beanHolder = null;
     }
 
+
     //todo: set response handler
     @Deprecated
-    public static KustvaktResponseHandler getResponseHandler() {
+    public static KustvaktResponseHandler getResponseHandler () {
         return null;
     }
 
-    public BeansFactory() {
-    }
+
+    public BeansFactory () {}
 
     public static class TypeBeanFactory {
 
         private ContextHolder holder;
 
-        private TypeBeanFactory(ContextHolder holder) {
+
+        private TypeBeanFactory (ContextHolder holder) {
             this.holder = holder;
         }
 
-        public <T> T getTypedBean(Collection objs, Class type) {
+
+        public <T> T getTypedBean (Collection objs, Class type) {
             for (Object o : objs) {
                 Type gtype = o.getClass().getGenericInterfaces()[0];
                 if (gtype instanceof ParameterizedType) {
@@ -116,11 +125,14 @@
                         return (T) o;
                 }
             }
-            throw new RuntimeException("Could not find typed bean in context for class '"+type+"'");
+            throw new RuntimeException(
+                    "Could not find typed bean in context for class '" + type
+                            + "'");
         }
 
+
         @Deprecated
-        public UserDataDbIface getUserDaoInstance(
+        public UserDataDbIface getUserDaoInstance (
                 Class<? extends Userdata> type) {
             return getTypedBean(this.holder.getUserDataDaos(), type);
         }
diff --git a/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java b/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java
index fc856b4..5344b98 100644
--- a/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java
+++ b/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java
@@ -21,12 +21,14 @@
     private String url;
     private String redirect_uri;
 
-    public ClientInfo(String client_id, String client_secret) {
+
+    public ClientInfo (String client_id, String client_secret) {
         this.client_id = client_id;
         this.client_secret = client_secret;
     }
 
-    public String toJSON() {
+
+    public String toJSON () {
         ObjectNode node = JsonUtils.createObjectNode();
         node.put("client_id", client_id);
         node.put("client_secret", client_secret);
@@ -36,15 +38,16 @@
         return JsonUtils.toJSON(node);
     }
 
-    public String toString() {
-        return "client_id: " + client_id + "\n" +
-                "application_name: " + application_name + "\n" +
-                "url: " + url + "\n" +
-                "redirect_uri: " + redirect_uri + "\n";
+
+    public String toString () {
+        return "client_id: " + client_id + "\n" + "application_name: "
+                + application_name + "\n" + "url: " + url + "\n"
+                + "redirect_uri: " + redirect_uri + "\n";
     }
 
+
     //todo:
-    public static ClientInfo fromJSON(String json) {
+    public static ClientInfo fromJSON (String json) {
         return null;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java b/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
index 02e7232..b652a19 100644
--- a/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
+++ b/src/main/java/de/ids_mannheim/korap/config/ContextHolder.java
@@ -31,30 +31,35 @@
     private ApplicationContext context = null;
     private DefaultHandler handler;
 
-    public ContextHolder(ApplicationContext context) {
+
+    public ContextHolder (ApplicationContext context) {
         this.handler = new DefaultHandler();
         this.context = context;
         // todo: better method?!
         KustvaktResponseHandler.init(getAuditingProvider());
     }
 
-    protected <T> T getBean(Class<T> clazz) {
+
+    protected <T> T getBean (Class<T> clazz) {
         if (this.context != null) {
             try {
                 return context.getBean(clazz);
-            }catch (NoSuchBeanDefinitionException e) {
+            }
+            catch (NoSuchBeanDefinitionException e) {
                 // do nothing
             }
         }
         return this.handler.getDefault(clazz);
     }
 
-    protected <T> T getBean(String name) {
+
+    protected <T> T getBean (String name) {
         T bean = null;
         if (this.context != null) {
             try {
                 bean = (T) context.getBean(name);
-            }catch (NoSuchBeanDefinitionException e) {
+            }
+            catch (NoSuchBeanDefinitionException e) {
                 // do nothing
                 bean = (T) this.handler.getDefault(name);
             }
@@ -63,52 +68,61 @@
         return bean;
     }
 
-    public AuditingIface getAuditingProvider() {
+
+    public AuditingIface getAuditingProvider () {
         return (AuditingIface) getBean(KUSTVAKT_AUDITING);
     }
 
-    public <T extends KustvaktConfiguration> T getConfiguration() {
+
+    public <T extends KustvaktConfiguration> T getConfiguration () {
         return (T) getBean(KUSTVAKT_CONFIG);
     }
 
-    public PersistenceClient getPersistenceClient() {
+
+    public PersistenceClient getPersistenceClient () {
         return getBean(KUSTVAKT_DB);
     }
 
-    public Collection<UserDataDbIface> getUserDataDaos() {
+
+    public Collection<UserDataDbIface> getUserDataDaos () {
         return getBean(KUSTVAKT_USERDATA);
     }
 
-    public EncryptionIface getEncryption() {
+
+    public EncryptionIface getEncryption () {
         return getBean(KUSTVAKT_ENCRYPTION);
     }
 
-    public AuthenticationManagerIface getAuthenticationManager() {
+
+    public AuthenticationManagerIface getAuthenticationManager () {
         return getBean(KUSTVAKT_AUTHENTICATION_MANAGER);
     }
 
-    public EntityHandlerIface getUserDBHandler() {
+
+    public EntityHandlerIface getUserDBHandler () {
         return getBean(KUSTVAKT_USERDB);
     }
 
-    public PolicyHandlerIface getPolicyDbProvider() {
+
+    public PolicyHandlerIface getPolicyDbProvider () {
         Object b = getBean(KUSTVAKT_POLICIES);
         return (PolicyHandlerIface) b;
     }
 
 
-    public Collection<AuthenticationIface> getAuthProviders() {
+    public Collection<AuthenticationIface> getAuthProviders () {
         return getBean(KUSTVAKT_AUTHPROVIDERS);
     }
 
+
     // todo: !!!!!!!!!!!!!!!!!!!!!!!!!!
     // todo: more specific --> collection provider, document provider, etc.
-    public Collection<ResourceOperationIface> getResourceProvider() {
+    public Collection<ResourceOperationIface> getResourceProvider () {
         return getBean(KUSTVAKT_RESOURCES);
     }
 
 
-    private void finish() {
+    private void finish () {
         this.getAuditingProvider().finish();
         this.context = null;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java b/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java
index 38af9f3..982985f 100644
--- a/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/config/DefaultHandler.java
@@ -12,12 +12,14 @@
 
     private Map<String, Object> defaults;
 
-    public DefaultHandler() {
+
+    public DefaultHandler () {
         this.defaults = new HashMap<>();
         loadClasses();
     }
 
-    private void loadClasses() {
+
+    private void loadClasses () {
         Set<Class<?>> cls = KustvaktClassLoader
                 .loadFromAnnotation(Configurable.class);
         for (Class clazz : cls) {
@@ -25,17 +27,20 @@
                     .getAnnotation(Configurable.class);
             try {
                 this.defaults.put(c.value(), clazz.newInstance());
-            }catch (InstantiationException | IllegalAccessException e) {
+            }
+            catch (InstantiationException | IllegalAccessException e) {
                 throw new RuntimeException("Could not instantiate class");
             }
         }
     }
 
-    public Object getDefault(String name) {
+
+    public Object getDefault (String name) {
         return this.defaults.get(name);
     }
 
-    public <T> T getDefault(Class<T> tClass) {
+
+    public <T> T getDefault (Class<T> tClass) {
         for (Object o : this.defaults.values()) {
             if (o.getClass().equals(tClass))
                 return (T) o;
@@ -43,12 +48,14 @@
         return null;
     }
 
-    public void remove(String name) {
+
+    public void remove (String name) {
         this.defaults.remove(name);
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         return defaults.toString();
     }
 }
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 d959604..8d1d08b 100644
--- a/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
+++ b/src/main/java/de/ids_mannheim/korap/config/JWTSigner.java
@@ -29,23 +29,27 @@
     private JWSVerifier verifier;
     private final int defaultttl;
 
-    public JWTSigner(final byte[] secret, URL issuer, final int defaultttl) {
+
+    public JWTSigner (final byte[] secret, URL issuer, final int defaultttl) {
         this.issuer = issuer;
         this.signer = new MACSigner(secret);
         this.verifier = new MACVerifier(secret);
         this.defaultttl = defaultttl;
     }
 
-    public JWTSigner(final byte[] secret, String issuer)
+
+    public JWTSigner (final byte[] secret, String issuer)
             throws MalformedURLException {
         this(secret, new URL(issuer), 72 * 60 * 60);
     }
 
-    public SignedJWT createJWT(User user, Map<String, Object> attr) {
+
+    public SignedJWT createJWT (User user, Map<String, Object> attr) {
         return signContent(user, attr, defaultttl);
     }
 
-    public SignedJWT signContent(User user, Map<String, Object> attr, int ttl) {
+
+    public SignedJWT signContent (User user, Map<String, Object> attr, int ttl) {
         String scopes;
 
         JWTClaimsSet cs = new JWTClaimsSet();
@@ -58,33 +62,35 @@
 
         cs.setSubjectClaim(user.getUsername());
         if (attr.get(Attributes.CLIENT_ID) != null)
-            cs.setAudienceClaim(
-                    new String[] { (String) attr.get(Attributes.CLIENT_ID) });
-        cs.setExpirationTimeClaim(
-                TimeUtils.getNow().plusSeconds(ttl).getMillis());
+            cs.setAudienceClaim(new String[] { (String) attr
+                    .get(Attributes.CLIENT_ID) });
+        cs.setExpirationTimeClaim(TimeUtils.getNow().plusSeconds(ttl)
+                .getMillis());
         SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256),
                 cs);
         try {
             signedJWT.sign(signer);
-        }catch (JOSEException e) {
+        }
+        catch (JOSEException e) {
             return null;
         }
         return signedJWT;
     }
 
+
     /**
      * @param username
      * @param json
      * @return
      */
-    public SignedJWT signContent(String username, String userclient,
+    public SignedJWT signContent (String username, String userclient,
             String json, int ttl) {
         JWTClaimsSet cs = new JWTClaimsSet();
         cs.setSubjectClaim(username);
         if (!json.isEmpty())
             cs.setCustomClaim("data", json);
-        cs.setExpirationTimeClaim(
-                TimeUtils.getNow().plusSeconds(ttl).getMillis());
+        cs.setExpirationTimeClaim(TimeUtils.getNow().plusSeconds(ttl)
+                .getMillis());
         cs.setIssuerClaim(this.issuer.toString());
 
         if (!userclient.isEmpty())
@@ -94,27 +100,32 @@
                 cs);
         try {
             signedJWT.sign(signer);
-        }catch (JOSEException e) {
+        }
+        catch (JOSEException e) {
             return null;
         }
         return signedJWT;
     }
 
-    public SignedJWT signContent(String username, String userclient,
+
+    public SignedJWT signContent (String username, String userclient,
             String json) {
         return signContent(username, userclient, json, defaultttl);
     }
 
-    public SignedJWT createSignedToken(String username) {
+
+    public SignedJWT createSignedToken (String username) {
         return createSignedToken(username, defaultttl);
     }
 
+
     // add client info
-    public SignedJWT createSignedToken(String username, int ttl) {
+    public SignedJWT createSignedToken (String username, int ttl) {
         return signContent(username, "", "", ttl);
     }
 
-    public SignedJWT verifyToken(String token) throws KustvaktException {
+
+    public SignedJWT verifyToken (String token) throws KustvaktException {
         SignedJWT client;
         try {
             client = SignedJWT.parse(token);
@@ -125,7 +136,8 @@
                     .isAfterNow())
                 throw new KustvaktException(StatusCodes.EXPIRED,
                         "authentication token is expired", token);
-        }catch (ParseException | JOSEException e) {
+        }
+        catch (ParseException | JOSEException e) {
             //todo: message or entity, how to treat??!
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                     "token could not be verified", token);
@@ -133,8 +145,9 @@
         return client;
     }
 
+
     // does not care about expiration times
-    public String retrieveContent(String signedContent)
+    public String retrieveContent (String signedContent)
             throws KustvaktException {
         SignedJWT jwt;
         try {
@@ -143,22 +156,24 @@
                 throw new KustvaktException(StatusCodes.REQUEST_INVALID,
                         "token invalid", signedContent);
             return (String) jwt.getJWTClaimsSet().getCustomClaim("data");
-        }catch (ParseException | JOSEException e) {
+        }
+        catch (ParseException | JOSEException e) {
             return null;
         }
     }
 
-    public TokenContext getTokenContext(String idtoken)
-            throws ParseException, JOSEException, KustvaktException {
+
+    public TokenContext getTokenContext (String idtoken) throws ParseException,
+            JOSEException, KustvaktException {
         SignedJWT signedJWT = verifyToken(idtoken);
 
         TokenContext c = new TokenContext();
         c.setUsername(signedJWT.getJWTClaimsSet().getSubjectClaim());
         if (signedJWT.getJWTClaimsSet().getAudienceClaim() != null)
-            c.addContextParameter(Attributes.CLIENT_ID,
-                    signedJWT.getJWTClaimsSet().getAudienceClaim()[0]);
-        c.setExpirationTime(
-                signedJWT.getJWTClaimsSet().getExpirationTimeClaim());
+            c.addContextParameter(Attributes.CLIENT_ID, signedJWT
+                    .getJWTClaimsSet().getAudienceClaim()[0]);
+        c.setExpirationTime(signedJWT.getJWTClaimsSet()
+                .getExpirationTimeClaim());
         c.setToken(idtoken);
         c.addParams(signedJWT.getJWTClaimsSet().getCustomClaims());
         return c;
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktBaseDaoInterface.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktBaseDaoInterface.java
index cc23238..2543d73 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktBaseDaoInterface.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktBaseDaoInterface.java
@@ -6,8 +6,9 @@
  */
 public interface KustvaktBaseDaoInterface {
 
-    int size();
+    int size ();
 
-    int truncate();
+
+    int truncate ();
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java
index f061daa..f3bcc53 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktCacheManager.java
@@ -15,12 +15,14 @@
 
     private static boolean loaded = false;
 
-    public static void init() {
+
+    public static void init () {
         if (!loaded) {
             InputStream in = null;
             try {
                 in = new FileInputStream(new File("./ehcache.xml"));
-            }catch (FileNotFoundException e) {
+            }
+            catch (FileNotFoundException e) {
                 // do nothing
             }
 
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 8832307..83100bc 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktClassLoader.java
@@ -16,26 +16,30 @@
     private static final Reflections reflections = new Reflections(
             "de.ids_mannheim.korap");
 
-    private KustvaktClassLoader() {
-    }
+
+    private KustvaktClassLoader () {}
+
 
     /**
      * loads interface implementations in current classpath
-     *
+     * 
      * @param iface
      * @param <T>
      * @return
      */
-    public static <T> Set<Class<? extends T>> loadSubTypes(Class<T> iface) {
+    public static <T> Set<Class<? extends T>> loadSubTypes (Class<T> iface) {
         return reflections.getSubTypesOf(iface);
     }
 
-    public static Set<Class<?>> loadFromAnnotation(
+
+    public static Set<Class<?>> loadFromAnnotation (
             Class<? extends Annotation> annotation) {
         return reflections.getTypesAnnotatedWith(annotation);
     }
 
-    public static <T> Class<? extends T> getTypeClass(Class type, Class<T> iface) {
+
+    public static <T> Class<? extends T> getTypeClass (Class type,
+            Class<T> iface) {
         Set<Class<? extends T>> c = KustvaktClassLoader.loadSubTypes(iface);
         for (Class<? extends T> o : c) {
             Type ctype = o.getGenericInterfaces()[0];
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index c2f3c0f..d9b5d8a 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -17,8 +17,9 @@
 import java.util.*;
 
 /**
- * if configuration class is extended, loadSubTypes method should be overriden
- *
+ * if configuration class is extended, loadSubTypes method should be
+ * overriden
+ * 
  * @author hanl
  * @date 05/02/2014
  */
@@ -85,21 +86,22 @@
     // deprec?!
     private final BACKENDS DEFAULT_ENGINE = BACKENDS.LUCENE;
 
+
     /**
      * loading of the properties and mapping to parameter variables
-     *
+     * 
      * @param properties
      * @return
      */
-    protected Properties load(Properties properties)
+    protected Properties load (Properties properties)
             throws MalformedURLException {
         maxhits = new Integer(properties.getProperty("maxhits", "50000"));
         returnhits = new Integer(properties.getProperty("returnhits", "50000"));
         indexDir = properties.getProperty("krill.indexDir", "");
         port = new Integer(properties.getProperty("server.port", "8095"));
         // server options
-        serverHost = String
-                .valueOf(properties.getProperty("server.host", "localhost"));
+        serverHost = String.valueOf(properties.getProperty("server.host",
+                "localhost"));
         String queries = properties.getProperty("korap.ql", "");
         String[] qls = queries.split(",");
         queryLanguages = new ArrayList<>();
@@ -116,81 +118,86 @@
         default_dep = properties.getProperty("kustvakt.default.dep", "mate");
         default_lemma = properties.getProperty("kustvakt.default.lemma", "tt");
         default_pos = properties.getProperty("kustvakt.default.pos", "tt");
-        default_token = properties
-                .getProperty("kustvakt.default.token", "opennlp");
+        default_token = properties.getProperty("kustvakt.default.token",
+                "opennlp");
 
         // security configuration
-        expiration = TimeUtils.convertTimeToSeconds(properties
-                .getProperty("security.absoluteTimeoutDuration", "25M"));
-        inactiveTime = TimeUtils.convertTimeToSeconds(
-                properties.getProperty("security.idleTimeoutDuration", "10M"));
-        allowMultiLogIn = Boolean
-                .valueOf(properties.getProperty("security.multipleLogIn"));
+        expiration = TimeUtils.convertTimeToSeconds(properties.getProperty(
+                "security.absoluteTimeoutDuration", "25M"));
+        inactiveTime = TimeUtils.convertTimeToSeconds(properties.getProperty(
+                "security.idleTimeoutDuration", "10M"));
+        allowMultiLogIn = Boolean.valueOf(properties
+                .getProperty("security.multipleLogIn"));
 
-        loginAttemptNum = Long.parseLong(
-                properties.getProperty("security.loginAttemptNum", "3"));
-        loginAttemptTTL = TimeUtils.convertTimeToSeconds(
-                properties.getProperty("security.authAttemptTTL", "30M"));
+        loginAttemptNum = Long.parseLong(properties.getProperty(
+                "security.loginAttemptNum", "3"));
+        loginAttemptTTL = TimeUtils.convertTimeToSeconds(properties
+                .getProperty("security.authAttemptTTL", "30M"));
 
-        loadFactor = Integer.valueOf(
-                properties.getProperty("security.encryption.loadFactor", "15"));
-        validationStringLength = Integer.valueOf(properties
-                .getProperty("security.validation.stringLength", "150"));
-        validationEmaillength = Integer.valueOf(properties
-                .getProperty("security.validation.emailLength", "40"));
+        loadFactor = Integer.valueOf(properties.getProperty(
+                "security.encryption.loadFactor", "15"));
+        validationStringLength = Integer.valueOf(properties.getProperty(
+                "security.validation.stringLength", "150"));
+        validationEmaillength = Integer.valueOf(properties.getProperty(
+                "security.validation.emailLength", "40"));
         encryption = Enum.valueOf(EncryptionIface.Encryption.class,
                 properties.getProperty("security.encryption", "BCRYPT"));
         sharedSecret = properties.getProperty("security.sharedSecret", "")
                 .getBytes();
         adminToken = properties.getProperty("security.adminToken");
 
-        longTokenTTL = TimeUtils.convertTimeToSeconds(
-                properties.getProperty("security.longTokenTTL", "100D"));
-        tokenTTL = TimeUtils.convertTimeToSeconds(
-                properties.getProperty("security.tokenTTL", "72H"));
-        shortTokenTTL = TimeUtils.convertTimeToSeconds(
-                properties.getProperty("security.shortTokenTTL", "3H"));
+        longTokenTTL = TimeUtils.convertTimeToSeconds(properties.getProperty(
+                "security.longTokenTTL", "100D"));
+        tokenTTL = TimeUtils.convertTimeToSeconds(properties.getProperty(
+                "security.tokenTTL", "72H"));
+        shortTokenTTL = TimeUtils.convertTimeToSeconds(properties.getProperty(
+                "security.shortTokenTTL", "3H"));
 
-        passcodeSaltField = properties
-                .getProperty("security.passcode.salt", "accountCreation");
+        passcodeSaltField = properties.getProperty("security.passcode.salt",
+                "accountCreation");
 
         return properties;
     }
 
+
     /**
      * set properties
-     *
+     * 
      * @param props
      */
-    public void setProperties(Properties props) throws MalformedURLException {
+    public void setProperties (Properties props) throws MalformedURLException {
         this.load(props);
     }
 
+
     /**
      * properties can be overloaded after spring init
-     *
+     * 
      * @param stream
      */
-    public void setPropertiesAsStream(InputStream stream) {
+    public void setPropertiesAsStream (InputStream stream) {
         try {
 
             Properties p = new Properties();
             p.load(stream);
             this.load(p);
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             e.printStackTrace();
         }
 
     }
 
-    public BACKENDS chooseBackend(String value) {
+
+    public BACKENDS chooseBackend (String value) {
         if (value == null || value.equals("null"))
             return DEFAULT_ENGINE;
         else
             return Enum.valueOf(BACKENDS.class, value.toUpperCase());
     }
 
-    public static void loadLog4jLogger() {
+
+    public static void loadLog4jLogger () {
         /** loadSubTypes log4j configuration file programmatically */
         Properties log4j = new Properties();
         try {
@@ -204,27 +211,28 @@
                         "./log4j.properties");
                 return;
             }
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             // do nothing
         }
         loadClassLogger();
     }
 
-    private static void loadClassLogger() {
+
+    private static void loadClassLogger () {
         Properties log4j = new Properties();
-        jlog.info(
-                "using class path logging properties file to configure logging system");
+        jlog.info("using class path logging properties file to configure logging system");
 
         try {
             log4j.load(KustvaktConfiguration.class.getClassLoader()
                     .getResourceAsStream("log4j.properties"));
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             // do nothing
         }
 
         PropertyConfigurator.configure(log4j);
-        jlog.warn(
-                "No logger properties detected. Using default logger properties");
+        jlog.warn("No logger properties detected. Using default logger properties");
     }
 
     public enum BACKENDS {
diff --git a/src/main/java/de/ids_mannheim/korap/config/KustvaktTypeInterface.java b/src/main/java/de/ids_mannheim/korap/config/KustvaktTypeInterface.java
index a5270bd..5980aa2 100644
--- a/src/main/java/de/ids_mannheim/korap/config/KustvaktTypeInterface.java
+++ b/src/main/java/de/ids_mannheim/korap/config/KustvaktTypeInterface.java
@@ -6,5 +6,5 @@
  */
 public interface KustvaktTypeInterface<T> {
 
-    Class<T> type();
+    Class<T> type ();
 }
diff --git a/src/main/java/de/ids_mannheim/korap/config/ParamFields.java b/src/main/java/de/ids_mannheim/korap/config/ParamFields.java
index 0dfa15b..2d9a255 100644
--- a/src/main/java/de/ids_mannheim/korap/config/ParamFields.java
+++ b/src/main/java/de/ids_mannheim/korap/config/ParamFields.java
@@ -12,19 +12,22 @@
 // could also be an array or list!
 public class ParamFields extends HashMap<String, ParamFields.Param> {
 
-    public void add(Param param) {
+    public void add (Param param) {
         this.put(param.getClass().getName(), param);
     }
 
-    public <T extends Param> T get(Class<T> cl) {
+
+    public <T extends Param> T get (Class<T> cl) {
         return (T) this.get(cl.getName());
     }
 
-    public <T extends Param> T remove(Class<T> cl) {
+
+    public <T extends Param> T remove (Class<T> cl) {
         return (T) this.remove(cl.getName());
     }
 
-    public void addAll(Collection<Param> params) {
+
+    public void addAll (Collection<Param> params) {
         for (Param p : params)
             super.put(p.getClass().getName(), p);
     }
@@ -32,7 +35,7 @@
     @Getter
     public abstract static class Param {
 
-        public boolean hasValues() {
+        public boolean hasValues () {
             return false;
         }
 
diff --git a/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java b/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java
index d0cfe19..bc21668 100644
--- a/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java
+++ b/src/main/java/de/ids_mannheim/korap/config/QueryBuilderUtil.java
@@ -8,9 +8,8 @@
  */
 public class QueryBuilderUtil {
 
-    public static MetaQueryBuilder defaultMetaBuilder(Integer pageIndex,
-            Integer pageInteger, Integer pageLength, String ctx,
-            Boolean cutoff) {
+    public static MetaQueryBuilder defaultMetaBuilder (Integer pageIndex,
+            Integer pageInteger, Integer pageLength, String ctx, Boolean cutoff) {
         MetaQueryBuilder meta = new MetaQueryBuilder();
         meta.addEntry("startIndex", pageIndex)
                 .addEntry("startPage", pageInteger)
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 cce49e8..a280c10 100644
--- a/src/main/java/de/ids_mannheim/korap/config/Scopes.java
+++ b/src/main/java/de/ids_mannheim/korap/config/Scopes.java
@@ -29,7 +29,8 @@
     private static final Enum[] SERVICE_DEFAULTS = { Scope.account,
             Scope.preferences, Scope.search, Scope.queries };
 
-    public static Scopes getProfileScopes(Map<String, Object> values) {
+
+    public static Scopes getProfileScopes (Map<String, Object> values) {
         Scopes r = new Scopes();
         for (String key : profile) {
             Object v = values.get(key);
@@ -39,21 +40,23 @@
         return r;
     }
 
+
     /**
      * expects space separated values
-     *
+     * 
      * @param scopes
      * @return
      */
     //todo: test
-    public static Scope[] mapScopes(String scopes) {
+    public static Scope[] mapScopes (String scopes) {
         List<Enum> s = new ArrayList<>();
         for (String value : scopes.split(" "))
             s.add(Scope.valueOf(value.toLowerCase()));
         return s.toArray(new Scope[s.size()]);
     }
 
-    public static Scopes mapScopes(String scopes, Map<String, Object> details) {
+
+    public static Scopes mapScopes (String scopes, Map<String, Object> details) {
         Scopes m = new Scopes();
         if (scopes != null && !scopes.isEmpty()) {
             Scope[] scopearr = mapScopes(scopes);
@@ -71,17 +74,20 @@
 
     private Map<String, Object> _values;
 
-    private Scopes() {
+
+    private Scopes () {
         this._values = new HashMap<>();
     }
 
-    public String toEntity() {
+
+    public String toEntity () {
         if (this._values.isEmpty())
             return "";
         return JsonUtils.toJSON(this._values);
     }
 
-    public Map<String, Object> toMap() {
+
+    public Map<String, Object> toMap () {
         return new HashMap<>(this._values);
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/config/URIParam.java b/src/main/java/de/ids_mannheim/korap/config/URIParam.java
index 3ab3724..9fd7911 100644
--- a/src/main/java/de/ids_mannheim/korap/config/URIParam.java
+++ b/src/main/java/de/ids_mannheim/korap/config/URIParam.java
@@ -12,13 +12,15 @@
     private final String uriFragment;
     private final Long uriExpiration;
 
-    public URIParam(String uri, Long expire) {
+
+    public URIParam (String uri, Long expire) {
         this.uriFragment = uri;
         this.uriExpiration = expire;
     }
 
+
     @Override
-    public boolean hasValues() {
+    public boolean hasValues () {
         return this.uriFragment != null && !this.uriFragment.isEmpty()
                 && this.uriExpiration != null;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java b/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java
index f510ac5..0a4bb7b 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/EmptyResultException.java
@@ -4,14 +4,16 @@
  * @author hanl
  * @date 25/03/2014
  */
-@Deprecated // even useful anymore?
+@Deprecated
+// even useful anymore?
 public class EmptyResultException extends KustvaktException {
 
-    public EmptyResultException(String message, String entity) {
+    public EmptyResultException (String message, String entity) {
         super(StatusCodes.EMPTY_RESULTS, message, entity);
     }
 
-    public EmptyResultException(String entity) {
+
+    public EmptyResultException (String entity) {
         super(StatusCodes.EMPTY_RESULTS, "No entity found for id", entity);
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/KustvaktException.java b/src/main/java/de/ids_mannheim/korap/exceptions/KustvaktException.java
index dc00049..68a3018 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/KustvaktException.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/KustvaktException.java
@@ -21,51 +21,56 @@
     private Integer statusCode;
     private String entity;
 
-    public KustvaktException(int status) {
+
+    public KustvaktException (int status) {
         this.statusCode = status;
     }
 
-    public KustvaktException(int status, String... args) {
+
+    public KustvaktException (int status, String ... args) {
         this.statusCode = status;
         this.entity = Arrays.asList(args).toString();
     }
 
-    public KustvaktException(Object userid, int status) {
+
+    public KustvaktException (Object userid, int status) {
         this(status);
         this.userid = String.valueOf(userid);
     }
 
-    public KustvaktException(Object userid, int status, String message,
-            String entity) {
+
+    public KustvaktException (Object userid, int status, String message,
+                              String entity) {
         super(message);
         this.statusCode = status;
         this.entity = entity;
         this.userid = String.valueOf(userid);
     }
 
-    public KustvaktException(int status, String message, String entity) {
+
+    public KustvaktException (int status, String message, String entity) {
         super(message);
         this.statusCode = status;
         this.entity = entity;
     }
 
-    public KustvaktException(Throwable cause, int status) {
+
+    public KustvaktException (Throwable cause, int status) {
         super(cause);
         this.statusCode = status;
     }
 
-    public KustvaktException(String message, Throwable cause, int status) {
+
+    public KustvaktException (String message, Throwable cause, int status) {
         super(message, cause);
         this.statusCode = status;
     }
 
+
     @Override
-    public String toString() {
-        return "Excpt{" +
-                "status=" + getStatusCode() +
-                ", message=" + getMessage() +
-                ", args=" + getEntity() +
-                ", userid=" + userid +
-                '}';
+    public String toString () {
+        return "Excpt{" + "status=" + getStatusCode() + ", message="
+                + getMessage() + ", args=" + getEntity() + ", userid=" + userid
+                + '}';
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java b/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
index 8b8d2c5..76438b4 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
@@ -11,23 +11,27 @@
 @Deprecated
 public class NotAuthorizedException extends KustvaktException {
 
-    public NotAuthorizedException(int status) {
+    public NotAuthorizedException (int status) {
         super(status);
     }
 
-    public NotAuthorizedException(int status, String entity) {
+
+    public NotAuthorizedException (int status, String entity) {
         super(status, "", entity);
     }
 
-    public NotAuthorizedException(int status, String message, String entity) {
+
+    public NotAuthorizedException (int status, String message, String entity) {
         super(status, message, entity);
     }
 
-    public NotAuthorizedException(Throwable cause, int status) {
+
+    public NotAuthorizedException (Throwable cause, int status) {
         super(cause, status);
     }
 
-    public NotAuthorizedException(String message, Throwable cause, int status) {
+
+    public NotAuthorizedException (String message, Throwable cause, int status) {
         super(message, cause, status);
     }
 }
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 4c40304..49b204e 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/StatusCodes.java
@@ -48,7 +48,8 @@
     public static final int CLIENT_AUTHORIZATION_FAILURE = 216;
 
     /**
-     * 500 status codes for access control related components (also policy rewrite)
+     * 500 status codes for access control related components (also
+     * policy rewrite)
      */
     public static final int PERMISSION_DENIED = 401;
     public static final int UNSUPPORTED_RESOURCE = 402;
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java b/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java
index 70702b7..60c0715 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/WrappedException.java
@@ -12,21 +12,24 @@
 // is the extension of the notauthorized exception!
 public class WrappedException extends KustvaktException {
 
-    private WrappedException(Object userid, Integer status, String message,
-            String args) {
+    private WrappedException (Object userid, Integer status, String message,
+                              String args) {
         super(String.valueOf(userid), status, message, args);
     }
 
-    public WrappedException(Object userid, Integer status, String... args) {
+
+    public WrappedException (Object userid, Integer status, String ... args) {
         this(userid, status, "", Arrays.asList(args).toString());
         AuditRecord record = AuditRecord.serviceRecord(userid, status, args);
         this.records.add(record);
     }
 
-    public WrappedException(KustvaktException e, Integer status, String... args) {
+
+    public WrappedException (KustvaktException e, Integer status,
+                             String ... args) {
         this(e.getUserid(), e.getStatusCode(), e.getMessage(), e.getEntity());
-        AuditRecord record = AuditRecord
-                .serviceRecord(e.getUserid(), status, args);
+        AuditRecord record = AuditRecord.serviceRecord(e.getUserid(), status,
+                args);
         record.setField_1(e.toString());
         this.records.addAll(e.getRecords());
         this.records.add(record);
diff --git a/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java b/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java
index 9818648..f6fdf23 100644
--- a/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java
+++ b/src/main/java/de/ids_mannheim/korap/exceptions/dbException.java
@@ -10,15 +10,15 @@
  */
 public class dbException extends KustvaktException {
 
-    private dbException(Object userid, Integer status, String message,
-            String args) {
+    private dbException (Object userid, Integer status, String message,
+                         String args) {
         super(String.valueOf(userid), status, message, args);
     }
 
-    public dbException(Object userid, String target, Integer status,
-            String... args) {
-        this(userid, status, "",
-                Arrays.asList(args).toString());
+
+    public dbException (Object userid, String target, Integer status,
+                        String ... args) {
+        this(userid, status, "", Arrays.asList(args).toString());
         AuditRecord record = new AuditRecord(AuditRecord.CATEGORY.DATABASE);
         record.setUserid(String.valueOf(userid));
         record.setStatus(status);
@@ -27,22 +27,20 @@
         this.records.add(record);
     }
 
-    public dbException(KustvaktException e, Integer status, String... args) {
+
+    public dbException (KustvaktException e, Integer status, String ... args) {
         this(e.getUserid(), e.getStatusCode(), e.getMessage(), e.getEntity());
-        AuditRecord record = AuditRecord
-                .dbRecord(e.getUserid(), status, args);
+        AuditRecord record = AuditRecord.dbRecord(e.getUserid(), status, args);
         record.setField_1(e.toString());
         this.records.addAll(e.getRecords());
         this.records.add(record);
     }
 
+
     @Override
-    public String toString() {
-        return "DBExcpt{" +
-                "status=" + getStatusCode() +
-                ", message=" + getMessage() +
-                ", args=" + getEntity() +
-                ", userid=" + this.getUserid() +
-                '}';
+    public String toString () {
+        return "DBExcpt{" + "status=" + getStatusCode() + ", message="
+                + getMessage() + ", args=" + getEntity() + ", userid="
+                + this.getUserid() + '}';
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java b/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java
index e55cae1..0a83118 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/BatchBuilder.java
@@ -25,11 +25,14 @@
 
     private JdbcOperations operations;
 
-    public BatchBuilder(JdbcOperations operations) {
+
+    public BatchBuilder (JdbcOperations operations) {
         this.operations = operations;
     }
 
-    public <T> List<T> selectFromIDs(String query, Collection ids, RowMapper<T> mapper) {
+
+    public <T> List<T> selectFromIDs (String query, Collection ids,
+            RowMapper<T> mapper) {
         List l = new ArrayList(ids);
         int size = ids.size();
         List<T> values = new ArrayList<>();
@@ -60,7 +63,8 @@
             l.removeAll(d);
             try {
                 values.addAll(this.operations.query(sql, args, mapper));
-            } catch (DataAccessException e) {
+            }
+            catch (DataAccessException e) {
                 log.error("Exception during database retrieval", e);
             }
 
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java b/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
index 4d7df7d..a477d31 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/DocumentDao.java
@@ -30,58 +30,62 @@
 
     private NamedParameterJdbcTemplate jdbcTemplate;
 
-    public DocumentDao(PersistenceClient client) {
+
+    public DocumentDao (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     @Override
-    public Document findbyId(Integer id, User user) throws KustvaktException {
+    public Document findbyId (Integer id, User user) throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("id", id);
         String sql = "select id, persistent_id, disabled, strftime('%s', created) as created from doc_store where id=:id";
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, s, new RowMapper<Document>() {
+            return this.jdbcTemplate.queryForObject(sql, s,
+                    new RowMapper<Document>() {
                         @Override
-                        public Document mapRow(ResultSet rs, int rowNum)
+                        public Document mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
                             Document doc = null;
                             if (!rs.isClosed()) {
                                 String s = rs.getString("persistent_id");
                                 System.out.println("VALUE IS " + s);
-                                doc = new Document(
-                                        rs.getString("persistent_id"));
+                                doc = new Document(rs
+                                        .getString("persistent_id"));
                                 doc.setId(rs.getInt("id"));
-                                doc.setCreated(
-                                        rs.getTimestamp("created").getTime());
+                                doc.setCreated(rs.getTimestamp("created")
+                                        .getTime());
                                 doc.setDisabled(rs.getBoolean("disabled"));
                             }
 
                             return doc;
                         }
                     });
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     // document id, consisting of corpus sigle, substring key and document number
     @Override
-    public Document findbyId(String id, User user) throws KustvaktException {
+    public Document findbyId (String id, User user) throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("id", id);
         //        strftime('%s', created) as created
         String sql = "select id, persistent_id, disabled, created from doc_store where persistent_id=:id;";
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, s, new RowMapper<Document>() {
+            return this.jdbcTemplate.queryForObject(sql, s,
+                    new RowMapper<Document>() {
                         @Override
-                        public Document mapRow(ResultSet rs, int rowNum)
+                        public Document mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
                             Document doc = null;
                             if (!rs.isClosed()) {
-                                doc = new Document(
-                                        rs.getString("persistent_id"));
+                                doc = new Document(rs
+                                        .getString("persistent_id"));
                                 doc.setId(rs.getInt("id"));
                                 doc.setCreated(rs.getLong("created"));
                                 doc.setDisabled(rs.getBoolean("disabled"));
@@ -90,23 +94,27 @@
                             return doc;
                         }
                     });
-        }catch (EmptyResultDataAccessException em) {
+        }
+        catch (EmptyResultDataAccessException em) {
             return null;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     //todo:
     @Override
-    public List<Document> getResources(Collection<Object> ids, User user)
+    public List<Document> getResources (Collection<Object> ids, User user)
             throws KustvaktException {
         return null;
     }
 
+
     @Override
-    public int updateResource(Document document, User user)
+    public int updateResource (Document document, User user)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("pid", document.getPersistentID());
@@ -114,18 +122,21 @@
         final String sql = "UPDATE doc_store set disabled=:dis where persistent_id=:pid;";
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     @Override
-    public int[] updateResources(List<Document> resources, User user)
+    public int[] updateResources (List<Document> resources, User user)
             throws KustvaktException {
         return new int[0];
     }
 
-    public List<Document> findbyCorpus(String corpus, int offset, int index)
+
+    public List<Document> findbyCorpus (String corpus, int offset, int index)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("corpus", corpus + "%");
@@ -134,33 +145,36 @@
         //strftime('%s', created) as
         final String sql = "select id, persistent_id, disabled, created from doc_store where (persistent_id like :corpus) limit :offset, :limit";
         try {
-            return this.jdbcTemplate
-                    .query(sql, source, new RowMapper<Document>() {
+            return this.jdbcTemplate.query(sql, source,
+                    new RowMapper<Document>() {
                         @Override
-                        public Document mapRow(ResultSet rs, int rowNum)
+                        public Document mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
                             // todo: test on empty/closed resultset!
                             if (!rs.isClosed()) {
-                                Document doc = new Document(
-                                        rs.getString("persistent_id"));
+                                Document doc = new Document(rs
+                                        .getString("persistent_id"));
                                 doc.setId(rs.getInt("id"));
-                                doc.setCreated(
-                                        rs.getTimestamp("created").getTime());
+                                doc.setCreated(rs.getTimestamp("created")
+                                        .getTime());
                                 doc.setDisabled(rs.getBoolean("disabled"));
                                 return doc;
                             }
                             return null;
                         }
                     });
-        }catch (EmptyResultDataAccessException em) {
+        }
+        catch (EmptyResultDataAccessException em) {
             em.printStackTrace();
             return Collections.emptyList();
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
 
-    public List<String> findbyCorpus(String corpus, boolean disabled)
+
+    public List<String> findbyCorpus (String corpus, boolean disabled)
             throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("corpus", corpus + "%");
@@ -168,17 +182,20 @@
         String sql = "SELECT persistent_id FROM doc_store WHERE (persistent_id like :corpus) AND disabled=:dis;";
         try {
             return this.jdbcTemplate.queryForList(sql, s, String.class);
-        }catch (EmptyResultDataAccessException em) {
+        }
+        catch (EmptyResultDataAccessException em) {
             em.printStackTrace();
             return Collections.emptyList();
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     // parent is disabled here
     @Override
-    public int storeResource(Document resource, User user)
+    public int storeResource (Document resource, User user)
             throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("id", resource.getPersistentID());
@@ -188,43 +205,50 @@
         String sql = "INSERT INTO doc_store (persistent_id, disabled) VALUES (:id, :dis)";
         try {
             return this.jdbcTemplate.update(sql, s);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                     "illegal argument given", resource.getPersistentID());
         }
     }
 
+
     @Override
-    public int deleteResource(String id, User user) throws KustvaktException {
+    public int deleteResource (String id, User user) throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("id", id);
         String sql = "delete from doc_store where persistent_id=:id;";
         try {
             return this.jdbcTemplate.update(sql, s);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
 
     }
 
+
     @Override
-    public int size() {
+    public int size () {
         return -1;
     }
 
+
     @Override
-    public int truncate() {
+    public int truncate () {
         String sql = "delete from doc_store;";
         try {
             return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return -1;
         }
     }
 
+
     @Override
-    public Class<Document> type() {
+    public Class<Document> type () {
         return Document.class;
     }
 }
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 aa1e725..5d58b46 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/EntityDao.java
@@ -38,24 +38,28 @@
     private static Logger jlog = LoggerFactory.getLogger(EntityDao.class);
     private NamedParameterJdbcTemplate jdbcTemplate;
 
-    public EntityDao(PersistenceClient client) {
+
+    public EntityDao (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     // usersettings are fetched plus basic account info, no details, since i rarely use them anyway!
     @Override
-    public User getAccount(String username) throws KustvaktException {
-        Map<String, String> namedParameters = Collections
-                .singletonMap("username", username);
+    public User getAccount (String username) throws KustvaktException {
+        Map<String, String> namedParameters = Collections.singletonMap(
+                "username", username);
         final String sql = "select a.* from korap_users as a where a.username=:username;";
         User user;
         try {
             user = this.jdbcTemplate.queryForObject(sql, namedParameters,
                     new RowMapperFactory.UserMapper());
-        }catch (EmptyResultDataAccessException ae) {
+        }
+        catch (EmptyResultDataAccessException ae) {
             jlog.warn("No user found for name '{}'", username);
             throw new EmptyResultException(username);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Could not retrieve user for name: " + username, e);
             throw new dbException(username, "korap_users",
                     StatusCodes.DB_GET_FAILED, username);
@@ -63,8 +67,9 @@
         return user;
     }
 
+
     @Override
-    public int updateAccount(User user) throws KustvaktException {
+    public int updateAccount (User user) throws KustvaktException {
         MapSqlParameterSource np = new MapSqlParameterSource();
         final String query;
         if (user instanceof KorAPUser) {
@@ -83,12 +88,13 @@
             //            }
             np.addValue("id", k.getId());
 
-            query = "UPDATE korap_users SET account_lock=:alo," +
-                    "account_link=:ali, password=:ps "
+            query = "UPDATE korap_users SET account_lock=:alo,"
+                    + "account_link=:ali, password=:ps "
                     //                    "uri_fragment=:frag," +
                     //                    "uri_expiration=:exp "
                     + "WHERE id=:id";
-        }else if (user instanceof ShibUser) {
+        }
+        else if (user instanceof ShibUser) {
             ShibUser s = (ShibUser) user;
             //todo:
             //            np.addValue("ali", s.getAccountLink());
@@ -98,14 +104,16 @@
             np.addValue("cn", s.getCn());
             np.addValue("mail", s.getMail());
 
-            query = "UPDATE shibusers SET account_link=:ali" +
-                    " eduPersonScopedAffiliation=:edu" +
-                    "mail=:mail, cn=:cn WHERE id=:id";
-        }else
+            query = "UPDATE shibusers SET account_link=:ali"
+                    + " eduPersonScopedAffiliation=:edu"
+                    + "mail=:mail, cn=:cn WHERE id=:id";
+        }
+        else
             return -1;
         try {
             return this.jdbcTemplate.update(query, np);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error(
                     "Could not update user account for user: " + user.getId(),
                     e);
@@ -115,8 +123,9 @@
         }
     }
 
+
     @Override
-    public int createAccount(User user) throws KustvaktException {
+    public int createAccount (User user) throws KustvaktException {
         final String query;
         MapSqlParameterSource np = new MapSqlParameterSource();
 
@@ -131,7 +140,8 @@
             if (param != null) {
                 np.addValue("uri", param.getUriFragment());
                 np.addValue("urie", param.getUriExpiration());
-            }else {
+            }
+            else {
                 np.addValue("uri", null);
                 np.addValue("urie", null);
             }
@@ -141,27 +151,26 @@
 
             if (user.getId() != -1)
                 query = "INSERT INTO korap_users (id, username, account_lock, "
-                        +
-                        "account_link, password, uri_fragment, " +
-                        "account_creation, " +
-                        "uri_expiration) VALUES (:id, :us, :alo, :ali, " +
-                        ":ps, :uri, :acr, :urie);";
+                        + "account_link, password, uri_fragment, "
+                        + "account_creation, "
+                        + "uri_expiration) VALUES (:id, :us, :alo, :ali, "
+                        + ":ps, :uri, :acr, :urie);";
             else
-                query = "INSERT INTO korap_users (username, account_lock, " +
-                        "account_link, password, uri_fragment, " +
-                        "account_creation, " +
-                        "uri_expiration) VALUES (:us, :alo, :ali, " +
-                        ":ps, :uri, :acr, :urie);";
+                query = "INSERT INTO korap_users (username, account_lock, "
+                        + "account_link, password, uri_fragment, "
+                        + "account_creation, "
+                        + "uri_expiration) VALUES (:us, :alo, :ali, "
+                        + ":ps, :uri, :acr, :urie);";
 
             //fixme: still applicable?
-        }else if (user instanceof ShibUser) {
+        }
+        else if (user instanceof ShibUser) {
             ShibUser s = (ShibUser) user;
 
             query = "INSERT INTO shibusers (username, type, account_link, account_creation "
-                    +
-                    "eduPersonScopedAffiliation, cn, mail) " +
-                    "VALUES (:us, :type, :ali, " +
-                    ":edu, :cn, :mail, :logs, :logft);";
+                    + "eduPersonScopedAffiliation, cn, mail) "
+                    + "VALUES (:us, :type, :ali, "
+                    + ":edu, :cn, :mail, :logs, :logft);";
             np.addValue("us", s.getUsername());
             np.addValue("ali", null);
             np.addValue("edu", s.getAffiliation());
@@ -180,17 +189,19 @@
             //            np.addValue("type", user.getType());
             //            np.addValue("alo", user.isAccountLocked());
             //            np.addValue("acr", System.currentTimeMillis());
-        }else
+        }
+        else
             return -1;
 
         KeyHolder holder = new GeneratedKeyHolder();
 
         try {
-            int r = this.jdbcTemplate
-                    .update(query, np, holder, new String[] { "id" });
+            int r = this.jdbcTemplate.update(query, np, holder,
+                    new String[] { "id" });
             user.setId(holder.getKey().intValue());
             return r;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Could not create user account with username: {}",
                     user.getUsername());
             throw new dbException(user.getUsername(), "korap_users",
@@ -198,15 +209,16 @@
         }
     }
 
+
     @Override
-    public int deleteAccount(final Integer userid) throws KustvaktException {
+    public int deleteAccount (final Integer userid) throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("user", userid);
 
         try {
             int r;
-            r = this.jdbcTemplate
-                    .update("DELETE FROM korap_users WHERE id=:user", s);
+            r = this.jdbcTemplate.update(
+                    "DELETE FROM korap_users WHERE id=:user", s);
             //            if (user instanceof KorAPUser)
             //                r = this.jdbcTemplate
             //                        .update("DELETE FROM korap_users WHERE username=:user",
@@ -218,7 +230,8 @@
             //            else
             //                r = -1;
             return r;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Could not delete account for user: " + userid, e);
             //            throw new KorAPException(e, StatusCodes.CONNECTION_ERROR);
             throw new dbException(userid, "korap_users",
@@ -227,22 +240,25 @@
 
     }
 
+
     @Override
-    public int truncate() {
+    public int truncate () {
         String sql = "DELETE FROM korap_users;";
         try {
             return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return -1;
         }
     }
 
+
     @Override
-    public int resetPassphrase(String username, String uriToken,
+    public int resetPassphrase (String username, String uriToken,
             String passphrase) throws KustvaktException {
         MapSqlParameterSource np = new MapSqlParameterSource();
-        final String query = "UPDATE korap_users SET " +
-                "uri_expiration=0, password=:pass WHERE uri_fragment=:uri AND uri_expiration > :now "
+        final String query = "UPDATE korap_users SET "
+                + "uri_expiration=0, password=:pass WHERE uri_fragment=:uri AND uri_expiration > :now "
                 + "AND username=:us AND uri_expiration > :now;";
         np.addValue("uri", uriToken);
         np.addValue("now", new Date(TimeUtils.getNow().getMillis()));
@@ -250,7 +266,8 @@
         np.addValue("us", username);
         try {
             return this.jdbcTemplate.update(query, np);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Could not reset password for name: " + username, e);
             throw new dbException(username, "korap_users",
                     StatusCodes.DB_UPDATE_FAILED, username, uriToken,
@@ -258,44 +275,46 @@
         }
     }
 
+
     @Override
-    public int activateAccount(String username, String uriToken)
+    public int activateAccount (String username, String uriToken)
             throws KustvaktException {
         MapSqlParameterSource np = new MapSqlParameterSource();
-        final String query = "UPDATE korap_users SET uri_fragment='', " +
-                "uri_expiration=0, account_lock=:lock WHERE uri_fragment=:uri AND username=:us AND "
-                +
-                "uri_expiration > :now;";
+        final String query = "UPDATE korap_users SET uri_fragment='', "
+                + "uri_expiration=0, account_lock=:lock WHERE uri_fragment=:uri AND username=:us AND "
+                + "uri_expiration > :now;";
         np.addValue("uri", uriToken);
         np.addValue("now", TimeUtils.getNow().getMillis());
         np.addValue("us", username);
         np.addValue("lock", BooleanUtils.getBoolean(false));
         try {
             return this.jdbcTemplate.update(query, np);
-        }catch (DataAccessException e) {
-            jlog.error("Could not confirm registration for name " + username,
-                    e);
+        }
+        catch (DataAccessException e) {
+            jlog.error("Could not confirm registration for name " + username, e);
             throw new dbException(username, "korap_users",
                     StatusCodes.DB_UPDATE_FAILED, username, uriToken);
         }
     }
 
+
     @Override
-    public int size() {
+    public int size () {
         final String query = "SELECT COUNT(*) FROM korap_users;";
-        return this.jdbcTemplate
-                .queryForObject(query, new HashMap<String, Object>(),
-                        Integer.class);
+        return this.jdbcTemplate.queryForObject(query,
+                new HashMap<String, Object>(), Integer.class);
     }
 
+
     //todo:
-    public List getAccountLinks(User user) {
+    public List getAccountLinks (User user) {
 
         return Collections.emptyList();
     }
 
+
     //todo:
-    public void setAccountParameters(User user) {
+    public void setAccountParameters (User user) {
         ParamFields fields = user.getFields();
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/JDBCAuditing.java b/src/main/java/de/ids_mannheim/korap/handlers/JDBCAuditing.java
index 4dca815..88fc7e6 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/JDBCAuditing.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/JDBCAuditing.java
@@ -21,67 +21,72 @@
 
     private NamedParameterJdbcTemplate template;
 
-    public JDBCAuditing(PersistenceClient client) {
+
+    public JDBCAuditing (PersistenceClient client) {
         this.template = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(
+    public <T extends AuditRecord> List<T> retrieveRecords (
             AuditRecord.CATEGORY category, DateTime day, DateTime until,
             boolean dayOnly, int limit) {
         MapSqlParameterSource p = new MapSqlParameterSource();
         p.addValue("limit", limit);
         p.addValue("cat", category.toString());
 
-        String sql =
-                "select * from audit_records where aud_timestamp > :today AND"
-                        + " aud_timestamp < :tomorr AND aud_category=:cat limit :limit;";
+        String sql = "select * from audit_records where aud_timestamp > :today AND"
+                + " aud_timestamp < :tomorr AND aud_category=:cat limit :limit;";
 
         if (dayOnly) {
             LocalDate today = day.toLocalDate();
             DateTime start = today.toDateTimeAtStartOfDay(day.getZone());
-            DateTime end = today.plusDays(1)
-                    .toDateTimeAtStartOfDay(day.getZone());
+            DateTime end = today.plusDays(1).toDateTimeAtStartOfDay(
+                    day.getZone());
             p.addValue("today", start.getMillis());
             p.addValue("tomorr", end.getMillis());
-        }else {
+        }
+        else {
             p.addValue("today", day.getMillis());
             p.addValue("tomorr", until.getMillis());
         }
-        return (List<T>) this.template
-                .query(sql, p, new RowMapperFactory.AuditMapper());
+        return (List<T>) this.template.query(sql, p,
+                new RowMapperFactory.AuditMapper());
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(
+    public <T extends AuditRecord> List<T> retrieveRecords (
             AuditRecord.CATEGORY category, User user, int limit) {
         MapSqlParameterSource p = new MapSqlParameterSource();
         p.addValue("limit", limit);
         p.addValue("us", user.getUsername());
         p.addValue("cat", category.toString());
 
-        String sql =
-                "select * from audit_records where aud_category=:cat and aud_user=:us "
-                        + "order by aud_timestamp desc limit :limit;";
+        String sql = "select * from audit_records where aud_category=:cat and aud_user=:us "
+                + "order by aud_timestamp desc limit :limit;";
 
-        return (List<T>) this.template
-                .query(sql, p, new RowMapperFactory.AuditMapper());
+        return (List<T>) this.template.query(sql, p,
+                new RowMapperFactory.AuditMapper());
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(LocalDate day,
+    public <T extends AuditRecord> List<T> retrieveRecords (LocalDate day,
             int hitMax) {
         return null;
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(String userID,
+    public <T extends AuditRecord> List<T> retrieveRecords (String userID,
             LocalDate start, LocalDate end, int hitMax) {
         return null;
     }
 
+
     @Override
-    public void apply() {
+    public void apply () {
         String sql;
         sql = "INSERT INTO audit_records (aud_target, aud_category, aud_user, aud_location, aud_timestamp, "
                 + "aud_status, aud_field_1, aud_args) "
@@ -105,8 +110,9 @@
         records.clear();
     }
 
+
     @Override
-    public void finish() {
+    public void finish () {
 
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java b/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
index 18b4e87..2d9e984 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/JDBCClient.java
@@ -26,7 +26,8 @@
     @Setter(AccessLevel.NONE)
     private DataSource dataSource;
 
-    public JDBCClient(DataSource datasource) {
+
+    public JDBCClient (DataSource datasource) {
         NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(
                 datasource);
         template.setCacheLimit(500);
@@ -34,19 +35,22 @@
         this.dataSource = datasource;
     }
 
-    public JDBCClient(DataSource dataSource, Resource resource)
+
+    public JDBCClient (DataSource dataSource, Resource resource)
             throws IOException {
         this(dataSource);
         this.setSchema(resource.getInputStream());
     }
 
+
     @Override
-    public void setSchema(InputStream stream) throws IOException {
+    public void setSchema (InputStream stream) throws IOException {
         super.setSchema(stream);
     }
 
+
     @Override
-    public boolean checkDatabase() {
+    public boolean checkDatabase () {
         int size;
         NamedParameterJdbcTemplate tmp = this.getSource();
         try {
@@ -54,29 +58,33 @@
             size = tmp.queryForObject(
                     "select count(*) from schema_version limit 5;",
                     new HashMap<String, Object>(), Integer.class);
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             System.out.println("No database schema found!");
             return false;
         }
         return size > 0;
     }
 
+
     @Override
-    public void setDatabase(String name) {
+    public void setDatabase (String name) {
         super.setDatabase(name);
         BooleanUtils.dbname = name;
     }
 
+
     // get schema file from configuration and create database
     @Override
-    public void createDatabase() {
+    public void createDatabase () {
         if (!checkDatabase()) {
             final ResourceDatabasePopulator rdp = new ResourceDatabasePopulator();
             rdp.addScript(new InputStreamResource(this.getSchema()));
             rdp.setSeparator("$$");
             try {
                 rdp.populate(this.dataSource.getConnection());
-            }catch (SQLException e) {
+            }
+            catch (SQLException e) {
                 // do nothing
                 e.printStackTrace();
             }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/OAuth2Handler.java b/src/main/java/de/ids_mannheim/korap/handlers/OAuth2Handler.java
index 1d571ae..c1ce959 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/OAuth2Handler.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/OAuth2Handler.java
@@ -11,7 +11,7 @@
 /**
  * extends OAuthDb to allow temporary caching of tokens
  * and authorizations (authorizations are not persisted in db)
- *
+ * 
  * @author hanl
  * @date 04/05/2015
  */
@@ -19,37 +19,42 @@
 
     private Cache cache;
 
-    public OAuth2Handler(PersistenceClient client) {
+
+    public OAuth2Handler (PersistenceClient client) {
         super(client);
         this.cache = CacheManager.getInstance().getCache("auth_codes");
     }
 
-    public AuthCodeInfo getAuthorization(String code) {
+
+    public AuthCodeInfo getAuthorization (String code) {
         Element e = this.cache.get(code);
         if (e != null)
             return (AuthCodeInfo) e.getObjectValue();
         return null;
     }
 
-    public void authorize(AuthCodeInfo code, User user)
+
+    public void authorize (AuthCodeInfo code, User user)
             throws KustvaktException {
         code.setUserId(user.getId());
         cache.put(new Element(code.getCode(), code));
     }
 
-    public boolean addToken(String code, String token, String refresh, int ttl)
+
+    public boolean addToken (String code, String token, String refresh, int ttl)
             throws KustvaktException {
         Element e = cache.get(code);
         if (e != null) {
             AuthCodeInfo info = (AuthCodeInfo) e.getObjectValue();
             cache.remove(code);
-            return super.addToken(token, refresh, info.getUserId(), info.getClientId(),
-                    info.getScopes(), ttl);
+            return super.addToken(token, refresh, info.getUserId(),
+                    info.getClientId(), info.getScopes(), ttl);
         }
         return false;
     }
 
-    public void exchangeToken(String refresh) {
+
+    public void exchangeToken (String refresh) {
 
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java b/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java
index 9b10f96..e2ad1e2 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/OAuthDb.java
@@ -32,65 +32,71 @@
     private static final Logger jlog = LoggerFactory.getLogger(OAuthDb.class);
     private NamedParameterJdbcTemplate jdbcTemplate;
 
-    public OAuthDb(PersistenceClient client) {
+
+    public OAuthDb (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
-    public ClientInfo getClient(String clientid) {
+
+    public ClientInfo getClient (String clientid) {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("cl", clientid);
         String sql = "select * from oauth2_client where client_id=:cl;";
 
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, s, new RowMapper<ClientInfo>() {
+            return this.jdbcTemplate.queryForObject(sql, s,
+                    new RowMapper<ClientInfo>() {
                         @Override
-                        public ClientInfo mapRow(ResultSet rs, int rowNum)
+                        public ClientInfo mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
-                            ClientInfo info = new ClientInfo(
-                                    rs.getString("client_id"),
-                                    rs.getString("client_secret"));
+                            ClientInfo info = new ClientInfo(rs
+                                    .getString("client_id"), rs
+                                    .getString("client_secret"));
                             info.setId(rs.getInt("id"));
                             info.setClient_type(rs.getString("client_type"));
                             info.setRedirect_uri(rs.getString("redirect_uri"));
                             info.setUrl(rs.getString("url"));
-                            info.setConfidential(
-                                    rs.getBoolean("is_confidential"));
+                            info.setConfidential(rs
+                                    .getBoolean("is_confidential"));
                             return info;
                         }
                     });
-        }catch (EmptyResultDataAccessException ex) {
+        }
+        catch (EmptyResultDataAccessException ex) {
             jlog.error("'{}' client found", clientid, ex.fillInStackTrace());
             return null;
         }
     }
 
+
     // fixme: what to delete? difference client/application table?
-    public boolean revokeToken(String token) throws KustvaktException {
+    public boolean revokeToken (String token) throws KustvaktException {
         String sql = "delete from oauth2_access_token WHERE access_token=:token;";
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("token", token);
         try {
             return this.jdbcTemplate.update(sql, s) == 1;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("token could not be revoked", e.fillInStackTrace());
             return false;
         }
     }
 
-    public boolean revokeAuthorization(ClientInfo info, User user) {
+
+    public boolean revokeAuthorization (ClientInfo info, User user) {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("us", user.getId());
         source.addValue("cls", info.getClient_secret());
         source.addValue("clid", info.getClient_id());
 
-        String tokens =
-                "delete from oauth2_access_token where user_id=:us and client_id in "
-                        + "(select client_id from oauth2_client where client_id=:clid and client_secret=:cls);";
+        String tokens = "delete from oauth2_access_token where user_id=:us and client_id in "
+                + "(select client_id from oauth2_client where client_id=:clid and client_secret=:cls);";
 
         try {
             this.jdbcTemplate.update(tokens, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("authorization could not be revoked for user '{}'",
                     user.getUsername());
             return false;
@@ -99,24 +105,25 @@
         return true;
     }
 
-    public boolean addToken(String token, String refresh, Integer userid,
+
+    public boolean addToken (String token, String refresh, Integer userid,
             String client_id, String scopes, int expiration)
             throws KustvaktException {
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("token", token);
         s.addValue("rt", refresh);
-        s.addValue("ex",
-                new Timestamp(TimeUtils.plusSeconds(expiration).getMillis()));
+        s.addValue("ex", new Timestamp(TimeUtils.plusSeconds(expiration)
+                .getMillis()));
         s.addValue("us", userid);
         s.addValue("sc", scopes);
         s.addValue("st", BooleanUtils.getBoolean(true));
         s.addValue("cli", client_id);
-        String sql =
-                "insert into oauth2_access_token (access_token, refresh_token, scopes, client_id, user_id, expiration, status) "
-                        + "values (:token, :rt, :sc, :cli, :us, :ex, :st);";
+        String sql = "insert into oauth2_access_token (access_token, refresh_token, scopes, client_id, user_id, expiration, status) "
+                + "values (:token, :rt, :sc, :cli, :us, :ex, :st);";
         try {
             return this.jdbcTemplate.update(sql, s) == 1;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             jlog.error("token '{}' could not be added for user '{}'", token,
                     userid);
@@ -124,29 +131,31 @@
         }
     }
 
+
     // returns the first token to find
-    public String getToken(String client_id, Integer userid) {
-        String sql =
-                "select access_token from oauth2_access_token where user_id=:uid"
-                        + " and status=1 and client_id=:cli limit 1;";
+    public String getToken (String client_id, Integer userid) {
+        String sql = "select access_token from oauth2_access_token where user_id=:uid"
+                + " and status=1 and client_id=:cli limit 1;";
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("uid", userid);
         s.addValue("cli", client_id);
         try {
             return this.jdbcTemplate.queryForObject(sql, s, String.class);
-        }catch (EmptyResultDataAccessException ex) {
+        }
+        catch (EmptyResultDataAccessException ex) {
             jlog.error("no token found for user '{}'", userid);
             return null;
-        }catch (DataAccessException ex) {
+        }
+        catch (DataAccessException ex) {
             jlog.error("token retrieval failed for user '{}'", userid);
             return null;
         }
     }
 
-    public List<ClientInfo> getAuthorizedClients(Integer userid) {
-        String sql =
-                "select cl.* from oauth2_client as cl where cl.client_id in (select cd.client_id from oauth2_access_token as cd "
-                        + "where cd.user_id=:user) or cl.is_confidential=:conf;";
+
+    public List<ClientInfo> getAuthorizedClients (Integer userid) {
+        String sql = "select cl.* from oauth2_client as cl where cl.client_id in (select cd.client_id from oauth2_access_token as cd "
+                + "where cd.user_id=:user) or cl.is_confidential=:conf;";
 
         //todo: test query
         //        "select cl.* from oauth2_client as cl inner join oauth2_access_token as cd "
@@ -160,7 +169,7 @@
             return this.jdbcTemplate.query(sql, s, new RowMapper<ClientInfo>() {
 
                 @Override
-                public ClientInfo mapRow(ResultSet rs, int rowNum)
+                public ClientInfo mapRow (ResultSet rs, int rowNum)
                         throws SQLException {
                     ClientInfo info = new ClientInfo(rs.getString("client_id"),
                             "*****");
@@ -171,28 +180,29 @@
                     return info;
                 }
             });
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Data access error", e);
             return Collections.emptyList();
         }
 
     }
 
+
     // todo: expired token must trigger an invalid token exception to trigger a refresh token
-    public TokenContext getContext(final String token)
+    public TokenContext getContext (final String token)
             throws KustvaktException {
-        String sql =
-                "select ko.username, oa.expiration, oa.scopes from oauth2_access_token as oa inner join korap_users as ko "
-                        + "on ko.id=oa.user_id where oa.access_token=:token and oa.expiration > :now;";
+        String sql = "select ko.username, oa.expiration, oa.scopes from oauth2_access_token as oa inner join korap_users as ko "
+                + "on ko.id=oa.user_id where oa.access_token=:token and oa.expiration > :now;";
         MapSqlParameterSource s = new MapSqlParameterSource();
         s.addValue("token", token);
         s.addValue("now", new Timestamp(TimeUtils.getNow().getMillis()));
 
         try {
-            TokenContext context = this.jdbcTemplate
-                    .queryForObject(sql, s, new RowMapper<TokenContext>() {
+            TokenContext context = this.jdbcTemplate.queryForObject(sql, s,
+                    new RowMapper<TokenContext>() {
                         @Override
-                        public TokenContext mapRow(ResultSet rs, int rowNum)
+                        public TokenContext mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
                             long exp = rs.getTimestamp("expiration").getTime();
                             TokenContext c = new TokenContext();
@@ -206,11 +216,13 @@
                         }
                     });
             return context;
-        }catch (EmptyResultDataAccessException ee) {
+        }
+        catch (EmptyResultDataAccessException ee) {
             jlog.error("no context found for token '{}'", token);
             revokeToken(token);
             throw new KustvaktException(StatusCodes.EXPIRED, "token", token);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("token context retrieval failed for '{}'", token);
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                     "invalid token", token);
@@ -218,19 +230,20 @@
 
     }
 
+
     // subsequently delete all access and auth code tokens associated!
-    public void removeClient(ClientInfo info, User user)
+    public void removeClient (ClientInfo info, User user)
             throws KustvaktException {
         MapSqlParameterSource p = new MapSqlParameterSource();
         p.addValue("url", info.getUrl());
         p.addValue("cls", info.getClient_secret());
         p.addValue("clid", info.getClient_id());
-        String sql =
-                "delete from oauth2_client where client_id=:clid and client_secret=:cls and"
-                        + " url=:url;";
+        String sql = "delete from oauth2_client where client_id=:clid and client_secret=:cls and"
+                + " url=:url;";
         try {
             this.jdbcTemplate.update(sql, p);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             jlog.error("removing client '{}' failed", info.getClient_id());
             throw new dbException(new KustvaktException(user.getId(),
@@ -241,7 +254,8 @@
         }
     }
 
-    public void registerClient(ClientInfo info, User user)
+
+    public void registerClient (ClientInfo info, User user)
             throws KustvaktException {
         MapSqlParameterSource p = new MapSqlParameterSource();
         p.addValue("clid", info.getClient_id());
@@ -250,12 +264,12 @@
         p.addValue("clt", info.getClient_type());
         p.addValue("url", info.getUrl());
         p.addValue("r_url", info.getRedirect_uri());
-        String sql =
-                "insert into oauth2_client (client_id, client_secret, client_type, url, is_confidential, redirect_uri) "
-                        + "VALUES (:clid, :cls, :clt, :url, :con, :r_url);";
+        String sql = "insert into oauth2_client (client_id, client_secret, client_type, url, is_confidential, redirect_uri) "
+                + "VALUES (:clid, :cls, :clt, :url, :con, :r_url);";
         try {
             this.jdbcTemplate.update(sql, p);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             jlog.error("registering client '{}' failed", info.getClient_id());
             throw new dbException(new KustvaktException(user.getId(),
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
index 2f62d4f..dd2657a 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/ResourceDao.java
@@ -27,45 +27,48 @@
  * Created by hanl on 7/21/14.
  */
 //todo: auditing // testing
-public class ResourceDao<T extends KustvaktResource>
-        implements ResourceOperationIface<T> {
+public class ResourceDao<T extends KustvaktResource> implements
+        ResourceOperationIface<T> {
 
     private static Logger log = LoggerFactory.getLogger(ResourceDao.class);
     protected final NamedParameterJdbcTemplate jdbcTemplate;
 
-    public ResourceDao(PersistenceClient client) {
+
+    public ResourceDao (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     @Override
-    public Class<T> type() {
+    public Class<T> type () {
         return (Class<T>) KustvaktResource.class;
     }
 
+
     // todo: testing
     @Override
-    public List<T> getResources(Collection<Object> ids, User user)
+    public List<T> getResources (Collection<Object> ids, User user)
             throws KustvaktException {
-        String sql =
-                "SELECT rs.*, rt.name_path FROM resource_store as rs inner join resource_tree as rt"
-                        + " on rs.id=rt.child_id WHERE rs.id IN (:ids);";
+        String sql = "SELECT rs.*, rt.name_path FROM resource_store as rs inner join resource_tree as rt"
+                + " on rs.id=rt.child_id WHERE rs.id IN (:ids);";
         MapSqlParameterSource parameters = new MapSqlParameterSource();
         parameters.addValue("ids", ids);
         try {
             return (List<T>) this.jdbcTemplate.query(sql, parameters,
                     new RowMapperFactory.ResourceMapper());
-        }catch (DataAccessException e) {
-            log.error(
-                    "Exception during database retrieval for ids '" + ids + "'",
-                    e);
+        }
+        catch (DataAccessException e) {
+            log.error("Exception during database retrieval for ids '" + ids
+                    + "'", e);
             throw new dbException(user.getId(), "resource_store",
                     StatusCodes.DB_GET_FAILED, ids.toString());
         }
 
     }
 
+
     @Override
-    public int updateResource(T resource, User user) throws KustvaktException {
+    public int updateResource (T resource, User user) throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", resource.getPersistentID());
         source.addValue("name", resource.getName());
@@ -74,37 +77,42 @@
         final String sql = "UPDATE resource_store set name=:name, data=:data, description=:desc where persistent_id=:id;";
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
-            log.error("Exception during database update for id '" + resource
-                    .getPersistentID() + "'", e);
+        }
+        catch (DataAccessException e) {
+            log.error(
+                    "Exception during database update for id '"
+                            + resource.getPersistentID() + "'", e);
             throw new dbException(user.getId(), "resource_store",
                     StatusCodes.DB_UPDATE_FAILED, resource.toString());
         }
     }
 
+
     @Override
-    public int[] updateResources(List<T> resources, User user)
+    public int[] updateResources (List<T> resources, User user)
             throws KustvaktException {
         return new int[1];
     }
 
+
     @Override
-    public <T extends KustvaktResource> T findbyId(String id, User user)
+    public <T extends KustvaktResource> T findbyId (String id, User user)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("pid", id);
-        String sql =
-                "SELECT rs.*, rt.name_path FROM resource_store as rs inner join resource_tree as rt"
-                        + " on rs.id=rt.child_id WHERE rs.persistent_id=:pid group by rs.id;";
+        String sql = "SELECT rs.*, rt.name_path FROM resource_store as rs inner join resource_tree as rt"
+                + " on rs.id=rt.child_id WHERE rs.persistent_id=:pid group by rs.id;";
         try {
             return (T) this.jdbcTemplate.queryForObject(sql, source,
                     new RowMapperFactory.ResourceMapper());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return null;
         }
     }
 
-    public KustvaktResource findbyPath(String path, User user)
+
+    public KustvaktResource findbyPath (String path, User user)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("path", path);
@@ -112,7 +120,8 @@
         try {
             return this.jdbcTemplate.queryForObject(sql, source,
                     new RowMapperFactory.ResourceMapper());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             if (e instanceof IncorrectResultSizeDataAccessException)
                 throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                         "invalid request path given!", path);
@@ -120,18 +129,19 @@
         }
     }
 
+
     @Override
-    public <T extends KustvaktResource> T findbyId(Integer id, User user)
+    public <T extends KustvaktResource> T findbyId (Integer id, User user)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", id);
-        String sql =
-                "SELECT rs.*, rt.name_path FROM resource_store as rs inner join resource_tree as rt on rs.id=rt.child_id "
-                        + "WHERE rs.id=:id group by rs.id order by rt.depth desc;";
+        String sql = "SELECT rs.*, rt.name_path FROM resource_store as rs inner join resource_tree as rt on rs.id=rt.child_id "
+                + "WHERE rs.id=:id group by rs.id order by rt.depth desc;";
         try {
             return (T) this.jdbcTemplate.queryForObject(sql, source,
                     new RowMapperFactory.ResourceMapper());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             if (e instanceof IncorrectResultSizeDataAccessException)
                 throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                         "invalid request id given!", String.valueOf(id));
@@ -139,8 +149,9 @@
         }
     }
 
+
     @Override
-    public int storeResource(T resource, User user) throws KustvaktException {
+    public int storeResource (T resource, User user) throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         KeyHolder holder = new GeneratedKeyHolder();
         // parent_id necessary so trigger can be used for tree insert!
@@ -149,14 +160,14 @@
         b.insert(Attributes.NAME, Attributes.PARENT_ID,
                 Attributes.PERSISTENT_ID, Attributes.DESCRIPTION,
                 Attributes.CREATOR, Attributes.TYPE, Attributes.CREATED);
-        b.params(
-                ":name, :parent, :pid, :desc, :ow, :type, :created, :dtype, :data");
+        b.params(":name, :parent, :pid, :desc, :ow, :type, :created, :dtype, :data");
 
         if (resource.getParentID() == null) {
             sql = "INSERT INTO resource_store (name, parent_id, persistent_id, description, creator, type, created, data) "
                     + "VALUES (:name, :parent, :pid, :desc, :ow, :type, :created, :data);";
             parid = null;
-        }else {
+        }
+        else {
             // fixme: use trigger for consistency check!
             sql = "INSERT INTO resource_store (name, parent_id, persistent_id, description, creator, type, created, data) "
                     + "select :name, id, :pid, :desc, :ow, :type, :created, :data from resource_store where persistent_id=:parent;";
@@ -176,9 +187,11 @@
         try {
             this.jdbcTemplate
                     .update(sql, source, holder, new String[] { "id" });
-        }catch (DataAccessException e) {
-            log.error("Exception during database store for id '" + resource
-                    .getPersistentID() + "'", e);
+        }
+        catch (DataAccessException e) {
+            log.error(
+                    "Exception during database store for id '"
+                            + resource.getPersistentID() + "'", e);
             throw new dbException(user.getId(), "resource_store",
                     StatusCodes.DB_INSERT_FAILED, resource.toString());
         }
@@ -186,37 +199,42 @@
         return resource.getId();
     }
 
+
     @Override
-    public int deleteResource(String id, User user) throws KustvaktException {
+    public int deleteResource (String id, User user) throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", id);
         final String sql = "DELETE FROM resource_store WHERE persistent_id=:id;";
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new dbException(user.getId(), "resource_store",
                     StatusCodes.DB_DELETE_FAILED, id);
         }
     }
 
+
     @Override
-    public int size() {
+    public int size () {
         final String sql = "SELECT COUNT(*) FROM resource_store;";
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, new HashMap<String, Object>(),
-                            Integer.class);
-        }catch (DataAccessException e) {
+            return this.jdbcTemplate.queryForObject(sql,
+                    new HashMap<String, Object>(), Integer.class);
+        }
+        catch (DataAccessException e) {
             return 0;
         }
     }
 
+
     @Override
-    public int truncate() {
+    public int truncate () {
         final String sql = "DELETE FROM resource_store;";
         try {
             return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return -1;
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/RowMapperFactory.java b/src/main/java/de/ids_mannheim/korap/handlers/RowMapperFactory.java
index 9ed2524..43d5af5 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/RowMapperFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/RowMapperFactory.java
@@ -24,7 +24,7 @@
     public static class UserMapMapper implements RowMapper<Map> {
 
         @Override
-        public Map mapRow(ResultSet rs, int rowNum) throws SQLException {
+        public Map mapRow (ResultSet rs, int rowNum) throws SQLException {
             User user = new UserMapper().mapRow(rs, rowNum);
             return user.toMap();
         }
@@ -33,7 +33,7 @@
     public static class UserMapper implements RowMapper<User> {
 
         @Override
-        public User mapRow(ResultSet rs, int rowNum) throws SQLException {
+        public User mapRow (ResultSet rs, int rowNum) throws SQLException {
             User user;
             switch (rs.getInt("type")) {
                 case 0:
@@ -45,17 +45,17 @@
                 default:
                     user = User.UserFactory.getDemoUser();
                     user.setId(rs.getInt("id"));
-                    user.setAccountCreation(
-                            rs.getTimestamp(Attributes.ACCOUNT_CREATION)
-                                    .getTime());
+                    user.setAccountCreation(rs.getTimestamp(
+                            Attributes.ACCOUNT_CREATION).getTime());
                     return user;
             }
             return user;
         }
 
-        private KorAPUser getKorAP(ResultSet rs) throws SQLException {
-            KorAPUser user = User.UserFactory
-                    .getUser(rs.getString(Attributes.USERNAME));
+
+        private KorAPUser getKorAP (ResultSet rs) throws SQLException {
+            KorAPUser user = User.UserFactory.getUser(rs
+                    .getString(Attributes.USERNAME));
             user.setPassword(rs.getString(Attributes.PASSWORD));
             user.setId(rs.getInt(Attributes.ID));
             user.setAccountLocked(rs.getBoolean(Attributes.ACCOUNTLOCK));
@@ -63,17 +63,18 @@
             user.setAccountLink(rs.getString(Attributes.ACCOUNTLINK));
             long l = rs.getLong(Attributes.URI_EXPIRATION);
 
-            URIParam param = new URIParam(rs.getString(Attributes.URI_FRAGMENT),
-                    l == 0 ? -1 : new Timestamp(l).getTime());
+            URIParam param = new URIParam(
+                    rs.getString(Attributes.URI_FRAGMENT), l == 0 ? -1
+                            : new Timestamp(l).getTime());
             user.addField(param);
             return user;
         }
 
-        private ShibUser getShib(ResultSet rs) throws SQLException {
-            ShibUser user = User.UserFactory
-                    .getShibInstance(rs.getString(Attributes.USERNAME),
-                            rs.getString(Attributes.MAIL),
-                            rs.getString(Attributes.CN));
+
+        private ShibUser getShib (ResultSet rs) throws SQLException {
+            ShibUser user = User.UserFactory.getShibInstance(
+                    rs.getString(Attributes.USERNAME),
+                    rs.getString(Attributes.MAIL), rs.getString(Attributes.CN));
             user.setId(rs.getInt(Attributes.ID));
             return user;
         }
@@ -83,10 +84,10 @@
     public static class AuditMapper implements RowMapper<AuditRecord> {
 
         @Override
-        public AuditRecord mapRow(ResultSet rs, int rowNum)
+        public AuditRecord mapRow (ResultSet rs, int rowNum)
                 throws SQLException {
-            AuditRecord r = new AuditRecord(
-                    AuditRecord.CATEGORY.valueOf(rs.getString("aud_category")));
+            AuditRecord r = new AuditRecord(AuditRecord.CATEGORY.valueOf(rs
+                    .getString("aud_category")));
             r.setUserid(rs.getString("aud_user"));
             r.setField_1(rs.getString("aud_field_1"));
             r.setTimestamp(rs.getTimestamp("aud_timestamp").getTime());
@@ -100,7 +101,7 @@
     public static class ResourceMapper implements RowMapper<KustvaktResource> {
 
         @Override
-        public KustvaktResource mapRow(ResultSet rs, int rowNum)
+        public KustvaktResource mapRow (ResultSet rs, int rowNum)
                 throws SQLException {
             KustvaktResource r = ResourceFactory.getResource(rs.getInt("type"));
             if (r != null) {
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java b/src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java
index 42b0b60..4714ca8 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/UserDetailsDao.java
@@ -25,12 +25,14 @@
 
     private NamedParameterJdbcTemplate jdbcTemplate;
 
-    public UserDetailsDao(PersistenceClient client) {
+
+    public UserDetailsDao (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     @Override
-    public int store(UserDetails data) {
+    public int store (UserDetails data) {
         String sql = "INSERT INTO user_details (user_id, data) VALUES (:userid, :data);";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("userid", data.getUserID());
@@ -42,14 +44,16 @@
             int id = gen.getKey().intValue();
             data.setId(id);
             return id;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             return -1;
         }
     }
 
+
     @Override
-    public int update(UserDetails data) {
+    public int update (UserDetails data) {
         String sql = "UPDATE user_details SET data = :data WHERE user_id=:userid;";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("userid", data.getUserID());
@@ -57,87 +61,98 @@
 
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             return -1;
         }
     }
 
+
     @Override
-    public UserDetails get(Integer id) throws dbException {
+    public UserDetails get (Integer id) throws dbException {
         String sql = "SELECT * FROM user_details WHERE id=:id;";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", id);
 
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, source, new RowMapper<UserDetails>() {
+            return this.jdbcTemplate.queryForObject(sql, source,
+                    new RowMapper<UserDetails>() {
 
                         @Override
-                        public UserDetails mapRow(ResultSet rs, int rowNum)
+                        public UserDetails mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
-                            UserDetails details = new UserDetails(
-                                    rs.getInt("user_id"));
+                            UserDetails details = new UserDetails(rs
+                                    .getInt("user_id"));
                             details.setId(rs.getInt("id"));
                             details.setData(rs.getString("data"));
                             return details;
                         }
                     });
 
-        }catch (EmptyResultDataAccessException ex) {
+        }
+        catch (EmptyResultDataAccessException ex) {
             return null;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new dbException(-1, "userDetails",
                     StatusCodes.REQUEST_INVALID, String.valueOf(id));
         }
     }
 
+
     @Override
-    public UserDetails get(User user) throws dbException {
+    public UserDetails get (User user) throws dbException {
         String sql = "SELECT * FROM user_details WHERE user_id=:userid;";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("userid", user.getId());
 
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, source, new RowMapper<UserDetails>() {
+            return this.jdbcTemplate.queryForObject(sql, source,
+                    new RowMapper<UserDetails>() {
 
                         @Override
-                        public UserDetails mapRow(ResultSet rs, int rowNum)
+                        public UserDetails mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
-                            UserDetails details = new UserDetails(
-                                    rs.getInt("user_id"));
+                            UserDetails details = new UserDetails(rs
+                                    .getInt("user_id"));
                             details.setId(rs.getInt("id"));
                             details.setData(rs.getString("data"));
                             return details;
                         }
                     });
-        }catch (EmptyResultDataAccessException ex) {
+        }
+        catch (EmptyResultDataAccessException ex) {
             return null;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new dbException(user.getId(), "userDetails",
                     StatusCodes.REQUEST_INVALID);
         }
     }
 
+
     @Override
-    public int delete(UserDetails data) {
+    public int delete (UserDetails data) {
         String sql = "DELETE FROM user_details WHERE id=:id";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", data.getId());
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return -1;
         }
     }
 
+
     @Override
-    public int deleteAll() {
+    public int deleteAll () {
         String sql = "DELETE FROM user_details;";
         try {
             return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             return -1;
         }
diff --git a/src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java b/src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java
index 6bb8453..2dfebdf 100644
--- a/src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java
+++ b/src/main/java/de/ids_mannheim/korap/handlers/UserSettingsDao.java
@@ -30,12 +30,14 @@
 
     private final NamedParameterJdbcTemplate jdbcTemplate;
 
-    public UserSettingsDao(PersistenceClient client) {
+
+    public UserSettingsDao (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     @Override
-    public int store(UserSettings data) {
+    public int store (UserSettings data) {
         String sql = "INSERT INTO user_settings (user_id, data) VALUES (:userid, :data);";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("userid", data.getUserID());
@@ -47,7 +49,8 @@
             int id = gen.getKey().intValue();
             data.setId(id);
             return id;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             jlog.error("couldn't store data in db for user with id '{}'",
                     data.getUserID());
@@ -55,8 +58,9 @@
         }
     }
 
+
     @Override
-    public int update(UserSettings data) {
+    public int update (UserSettings data) {
         String sql = "UPDATE user_settings SET data = :data WHERE user_id=:userid;";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("userid", data.getUserID());
@@ -64,87 +68,98 @@
 
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return -1;
         }
     }
 
+
     @Override
-    public UserSettings get(Integer id) throws dbException {
+    public UserSettings get (Integer id) throws dbException {
         String sql = "SELECT * FROM user_settings WHERE id=:id;";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", id);
 
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, source, new RowMapper<UserSettings>() {
+            return this.jdbcTemplate.queryForObject(sql, source,
+                    new RowMapper<UserSettings>() {
 
                         @Override
-                        public UserSettings mapRow(ResultSet rs, int rowNum)
+                        public UserSettings mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
-                            UserSettings details = new UserSettings(
-                                    rs.getInt("user_id"));
+                            UserSettings details = new UserSettings(rs
+                                    .getInt("user_id"));
                             details.setId(rs.getInt("id"));
                             details.setData(rs.getString("data"));
                             return details;
                         }
                     });
 
-        }catch (EmptyResultDataAccessException ex) {
+        }
+        catch (EmptyResultDataAccessException ex) {
             return null;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new dbException(-1, "userSettings",
                     StatusCodes.REQUEST_INVALID, String.valueOf(id));
         }
     }
 
+
     @Override
-    public UserSettings get(User user) throws dbException {
+    public UserSettings get (User user) throws dbException {
         String sql = "SELECT * FROM user_settings WHERE user_id=:userid;";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("userid", user.getId());
 
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, source, new RowMapper<UserSettings>() {
+            return this.jdbcTemplate.queryForObject(sql, source,
+                    new RowMapper<UserSettings>() {
 
                         @Override
-                        public UserSettings mapRow(ResultSet rs, int rowNum)
+                        public UserSettings mapRow (ResultSet rs, int rowNum)
                                 throws SQLException {
-                            UserSettings details = new UserSettings(
-                                    rs.getInt("user_id"));
+                            UserSettings details = new UserSettings(rs
+                                    .getInt("user_id"));
                             details.setId(rs.getInt("id"));
                             details.setData(rs.getString("data"));
                             return details;
                         }
                     });
 
-        }catch (EmptyResultDataAccessException ex) {
+        }
+        catch (EmptyResultDataAccessException ex) {
             return null;
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new dbException(-1, "userSettings",
                     StatusCodes.REQUEST_INVALID);
         }
     }
 
+
     @Override
-    public int delete(UserSettings data) {
+    public int delete (UserSettings data) {
         String sql = "DELETE FROM user_settings WHERE id=:id";
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", data.getId());
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             return -1;
         }
     }
 
+
     @Override
-    public int deleteAll() {
+    public int deleteAll () {
         String sql = "DELETE FROM user_settings;";
         try {
             return this.jdbcTemplate.update(sql, new HashMap<String, Object>());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             return -1;
         }
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 82d6737..5c5a9e8 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationIface.java
@@ -8,16 +8,19 @@
 
 public interface AuthenticationIface {
 
-    TokenContext getUserStatus(String authToken) throws
-            KustvaktException;
+    TokenContext getUserStatus (String authToken) throws KustvaktException;
 
-    TokenContext createUserSession(User user, Map<String, Object> attr)
+
+    TokenContext createUserSession (User user, Map<String, Object> attr)
             throws KustvaktException;
 
-    void removeUserSession(String token) throws KustvaktException;
 
-    TokenContext refresh(TokenContext context) throws KustvaktException;
+    void removeUserSession (String token) throws KustvaktException;
 
-    String getIdentifier();
+
+    TokenContext refresh (TokenContext context) throws KustvaktException;
+
+
+    String getIdentifier ();
 
 }
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 ca155eb..ab39aca 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/AuthenticationManagerIface.java
@@ -17,64 +17,81 @@
 
     private Map<String, AuthenticationIface> providers;
 
-    public AuthenticationManagerIface() {
+
+    public AuthenticationManagerIface () {
         this.providers = new HashMap<>();
     }
 
-    public void setProviders(Set<AuthenticationIface> providers) {
+
+    public void setProviders (Set<AuthenticationIface> providers) {
         for (AuthenticationIface i : providers)
             this.providers.put(i.getIdentifier().toUpperCase(), i);
     }
 
-    protected AuthenticationIface getProvider(String key,
-            String default_iface) {
-        AuthenticationIface iface = this.providers
-                .get(key != null ? key.toUpperCase() : "NONE");
+
+    protected AuthenticationIface getProvider (String key, String default_iface) {
+        AuthenticationIface iface = this.providers.get(key != null ? key
+                .toUpperCase() : "NONE");
         // todo: configurable authentication schema
         if (iface == null)
             iface = this.providers.get(default_iface);
         return iface;
     }
 
-    public abstract TokenContext getTokenStatus(String token, String host,
+
+    public abstract TokenContext getTokenStatus (String token, String host,
             String useragent) throws KustvaktException;
 
-    public abstract User getUser(String username) throws KustvaktException;
 
-    public abstract User authenticate(int type, String username,
+    public abstract User getUser (String username) throws KustvaktException;
+
+
+    public abstract User authenticate (int type, String username,
             String password, Map<String, Object> attributes)
             throws KustvaktException;
 
-    public abstract TokenContext createTokenContext(User user,
+
+    public abstract TokenContext createTokenContext (User user,
             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 void logout (TokenContext context) throws KustvaktException;
 
-    public abstract User createUserAccount(Map<String, Object> attributes,
+
+    public abstract void lockAccount (User user) throws KustvaktException;
+
+
+    public abstract User createUserAccount (Map<String, Object> attributes,
             boolean confirmation_required) throws KustvaktException;
 
+
     //    public abstract boolean updateAccount(User user) throws KustvaktException;
 
-    public abstract boolean deleteAccount(User user) throws KustvaktException;
+    public abstract boolean deleteAccount (User user) throws KustvaktException;
 
-    public abstract <T extends Userdata> T getUserData(User user,
+
+    public abstract <T extends Userdata> T getUserData (User user,
             Class<T> clazz) throws KustvaktException;
 
-    public abstract void updateUserData(Userdata data) throws KustvaktException;
 
-    public abstract Object[] validateResetPasswordRequest(String username,
+    public abstract void updateUserData (Userdata data)
+            throws KustvaktException;
+
+
+    public abstract Object[] validateResetPasswordRequest (String username,
             String email) throws KustvaktException;
 
-    public abstract void resetPassword(String uriFragment, String username,
+
+    public abstract void resetPassword (String uriFragment, String username,
             String newPassphrase) throws KustvaktException;
 
-    public abstract void confirmRegistration(String uriFragment,
+
+    public abstract void confirmRegistration (String uriFragment,
             String username) throws KustvaktException;
 
-    public String providerList() {
+
+    public String providerList () {
         return "provider list: " + this.providers.toString();
     }
 }
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 ec31ed7..7007fb8 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/EncryptionIface.java
@@ -13,26 +13,31 @@
         SIMPLE, ESAPICYPHER, BCRYPT
     }
 
+
     /**
      * One-way hashing of String input. Used to canonicalize
-     *
+     * 
      * @param input
      * @param salt
      * @return
      * @throws java.security.NoSuchAlgorithmException
      * @throws java.io.UnsupportedEncodingException
      */
-    public String produceSecureHash(String input, String salt)
+    public String produceSecureHash (String input, String salt)
             throws NoSuchAlgorithmException, UnsupportedEncodingException,
             KustvaktException;
 
-    public String produceSecureHash(String input)
+
+    public String produceSecureHash (String input)
             throws NoSuchAlgorithmException, UnsupportedEncodingException,
             KustvaktException;
 
-    public String hash(String text, String salt) throws Exception;
 
-    public String hash(String text) throws Exception;
+    public String hash (String text, String salt) throws Exception;
+
+
+    public String hash (String text) throws Exception;
+
 
     /**
      * @param plain
@@ -40,36 +45,45 @@
      * @param salt
      * @return
      */
-    public boolean checkHash(String plain, String hash, String salt);
+    public boolean checkHash (String plain, String hash, String salt);
 
-    public boolean checkHash(String plain, String hash);
 
-    public String getSalt(User user);
+    public boolean checkHash (String plain, String hash);
+
+
+    public String getSalt (User user);
+
 
     /**
      * create random String to be used as authentication token
-     *
+     * 
      * @return
      */
-    public String createToken(boolean hash, Object... obj);
+    public String createToken (boolean hash, Object ... obj);
 
-    public String createToken();
+
+    public String createToken ();
+
 
     /**
      * create a random Integer to be used as ID for databases
-     *
+     * 
      * @return
      */
-    public String createID(Object... obj);
+    public String createID (Object ... obj);
 
-    public String encodeBase();
 
-    public Map<String, Object> validateMap(Map<String, Object> map) throws KustvaktException;
+    public String encodeBase ();
 
-    public String validateEntry(String input, String type)
+
+    public Map<String, Object> validateMap (Map<String, Object> map)
             throws KustvaktException;
 
 
-//    public void validate(Object instance) throws KustvaktException;
+    public String validateEntry (String input, String type)
+            throws KustvaktException;
+
+
+    //    public void validate(Object instance) throws KustvaktException;
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/AuditingIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/AuditingIface.java
index ed21e60..5e6866b 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/AuditingIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/AuditingIface.java
@@ -22,26 +22,31 @@
             .synchronizedList(new ArrayList<>(BATCH_SIZE + 5));
     private final List<AuditRecord> buffer = new ArrayList<>(BATCH_SIZE + 5);
 
-    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords (
             AuditRecord.CATEGORY category, DateTime day, DateTime until,
             boolean exact, int limit);
 
-    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords (
             AuditRecord.CATEGORY category, User user, int limit);
 
-    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords (
             LocalDate day, int hitMax);
 
-    public abstract <T extends AuditRecord> List<T> retrieveRecords(
+
+    public abstract <T extends AuditRecord> List<T> retrieveRecords (
             String userID, LocalDate start, LocalDate end, int hitMax);
 
-    private void addAndRun(AuditRecord record) {
+
+    private void addAndRun (AuditRecord record) {
         if (buffer.size() > BATCH_SIZE) {
             records.clear();
             records.addAll(buffer);
             new Thread(new Runnable() {
                 @Override
-                public void run() {
+                public void run () {
                     apply();
                 }
             }).start();
@@ -51,21 +56,25 @@
             buffer.add(record);
     }
 
-    public <T extends AuditRecord> void audit(T request) {
+
+    public <T extends AuditRecord> void audit (T request) {
         addAndRun(request);
     }
 
-    public <T extends AuditRecord> void audit(List<T> requests) {
+
+    public <T extends AuditRecord> void audit (List<T> requests) {
         for (T rec : requests)
             addAndRun(rec);
     }
 
-    public abstract void apply();
 
-    protected List<AuditRecord> getRecordsToSave() {
+    public abstract void apply ();
+
+
+    protected List<AuditRecord> getRecordsToSave () {
         return this.records;
     }
 
 
-    public abstract void finish();
+    public abstract void finish ();
 }
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 a844fbc..456b385 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
@@ -11,20 +11,26 @@
  */
 public interface EntityHandlerIface {
 
-    User getAccount(String username)
-            throws EmptyResultException, KustvaktException;
+    User getAccount (String username) throws EmptyResultException,
+            KustvaktException;
 
-    int updateAccount(User user) throws KustvaktException;
 
-    int createAccount(User user) throws KustvaktException;
+    int updateAccount (User user) throws KustvaktException;
 
-    int deleteAccount(Integer userid) throws KustvaktException;
 
-    int truncate() throws KustvaktException;
+    int createAccount (User user) throws KustvaktException;
 
-    int resetPassphrase(String username, String uriToken, String passphrase)
+
+    int deleteAccount (Integer userid) throws KustvaktException;
+
+
+    int truncate () throws KustvaktException;
+
+
+    int resetPassphrase (String username, String uriToken, String passphrase)
             throws KustvaktException;
 
-    int activateAccount(String username, String uriToken)
+
+    int activateAccount (String username, String uriToken)
             throws KustvaktException;
 }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java
index 573d346..9fd0f79 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/PersistenceClient.java
@@ -13,39 +13,47 @@
     protected String database;
     private InputStream schema;
 
-    public PersistenceClient(String database, TYPE type) {
+
+    public PersistenceClient (String database, TYPE type) {
         this.type = type;
         this.database = database;
     }
 
-    public PersistenceClient(TYPE type) {
+
+    public PersistenceClient (TYPE type) {
         this.type = type;
     }
 
-    public PersistenceClient() {
-    }
 
-    protected void setSource(SOURCE conn) {
+    public PersistenceClient () {}
+
+
+    protected void setSource (SOURCE conn) {
         this.source = conn;
     }
 
-    public void setDatabase(String name) {
+
+    public void setDatabase (String name) {
         this.database = name;
     }
 
-    public void setSchema(String schema_path) throws FileNotFoundException {
+
+    public void setSchema (String schema_path) throws FileNotFoundException {
         this.schema = new FileInputStream(new File(schema_path));
     }
 
+
     // for spring configuration
     @Deprecated
-    public void setSchema(InputStream schema) throws IOException {
+    public void setSchema (InputStream schema) throws IOException {
         this.schema = schema;
     }
 
-    public abstract boolean checkDatabase();
 
-    public abstract void createDatabase() throws IOException;
+    public abstract boolean checkDatabase ();
+
+
+    public abstract void createDatabase () throws IOException;
 
     public enum TYPE {
         SQL, CASSANDRA
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/PolicyHandlerIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/PolicyHandlerIface.java
index b251de1..8c55953 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/PolicyHandlerIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/PolicyHandlerIface.java
@@ -21,7 +21,9 @@
      * @param user
      * @throws KustvaktException
      */
-    int createPolicy(SecurityPolicy policy, User user) throws KustvaktException;
+    int createPolicy (SecurityPolicy policy, User user)
+            throws KustvaktException;
+
 
     /**
      * @param target
@@ -29,16 +31,20 @@
      * @param perm
      * @return
      */
-    List<SecurityPolicy>[] getPolicies(Integer target, User user, Byte perm);
+    List<SecurityPolicy>[] getPolicies (Integer target, User user, Byte perm);
 
-    List<SecurityPolicy> getPolicies(PolicyCondition condition,Class<? extends KustvaktResource> clazz, Byte perm);
+
+    List<SecurityPolicy> getPolicies (PolicyCondition condition,
+            Class<? extends KustvaktResource> clazz, Byte perm);
+
 
     /**
      * @param policy
      * @return
      * @throws KustvaktException
      */
-    void mapConstraints(SecurityPolicy policy) throws KustvaktException;
+    void mapConstraints (SecurityPolicy policy) throws KustvaktException;
+
 
     /**
      * @param target
@@ -46,7 +52,8 @@
      * @param perm
      * @return
      */
-    List<SecurityPolicy>[] getPolicies(String target, User user, Byte perm);
+    List<SecurityPolicy>[] getPolicies (String target, User user, Byte perm);
+
 
     /**
      * @param path
@@ -55,7 +62,8 @@
      * @return
      */
     // todo: refactor
-    List<SecurityPolicy>[] findPolicies(String path, User user, Byte perm);
+    List<SecurityPolicy>[] findPolicies (String path, User user, Byte perm);
+
 
     /**
      * @param path
@@ -65,10 +73,11 @@
      * @return
      * @throws KustvaktException
      */
-    List<KustvaktResource.Container> getDescending(String path, User user,
+    List<KustvaktResource.Container> getDescending (String path, User user,
             Byte b, Class<? extends KustvaktResource> clazz)
             throws KustvaktException;
 
+
     /**
      * @param path
      * @param user
@@ -77,15 +86,17 @@
      * @return
      * @throws KustvaktException
      */
-    List<KustvaktResource.Container> getAscending(String path, User user,
+    List<KustvaktResource.Container> getAscending (String path, User user,
             Byte b, Class<? extends KustvaktResource> clazz)
             throws KustvaktException;
 
+
     /**
      * @param id
      * @param user
      */
-    int deleteResourcePolicies(String id, User user) throws KustvaktException;
+    int deleteResourcePolicies (String id, User user) throws KustvaktException;
+
 
     /**
      * @param policy
@@ -93,7 +104,9 @@
      * @return
      * @throws KustvaktException
      */
-    int deletePolicy(SecurityPolicy policy, User user) throws KustvaktException;
+    int deletePolicy (SecurityPolicy policy, User user)
+            throws KustvaktException;
+
 
     /**
      * @param policy
@@ -101,16 +114,19 @@
      * @return
      * @throws KustvaktException
      */
-    int updatePolicy(SecurityPolicy policy, User user) throws KustvaktException;
+    int updatePolicy (SecurityPolicy policy, User user)
+            throws KustvaktException;
+
 
     /**
      * checks if a similar policy already exists
-     *
+     * 
      * @param policy
      * @return
      * @throws KustvaktException
      */
-    int checkPolicy(SecurityPolicy policy, User user) throws KustvaktException;
+    int checkPolicy (SecurityPolicy policy, User user) throws KustvaktException;
+
 
     /**
      * @param user
@@ -119,9 +135,10 @@
      * @return
      * @throws KustvaktException
      */
-    int matchCondition(User user, String name, boolean owner)
+    int matchCondition (User user, String name, boolean owner)
             throws KustvaktException;
 
+
     /**
      * @param username
      * @param condition
@@ -129,9 +146,10 @@
      * @return
      * @throws KustvaktException
      */
-    int addToCondition(String username, PolicyCondition condition,
+    int addToCondition (String username, PolicyCondition condition,
             boolean admin) throws KustvaktException;
 
+
     /**
      * @param usernames
      * @param condition
@@ -140,37 +158,42 @@
      */
 
     //todo: add a handler user id, to skip the matching step in the corpusmanagement segment!
-    int[] addToCondition(List<String> usernames, PolicyCondition condition,
+    int[] addToCondition (List<String> usernames, PolicyCondition condition,
             boolean status) throws KustvaktException;
 
+
     /**
      * @param usernames
      * @param condition
      * @throws KustvaktException
      */
-    void removeFromCondition(List<String> usernames, PolicyCondition condition)
+    void removeFromCondition (List<String> usernames, PolicyCondition condition)
             throws KustvaktException;
 
+
     /**
      * @param param
      * @throws KustvaktException
      */
-    int createParamBinding(Parameter param) throws KustvaktException;
+    int createParamBinding (Parameter param) throws KustvaktException;
+
 
     /**
      * @param condition
      * @return
      * @throws KustvaktException
      */
-    List<String> getUsersFromCondition(PolicyCondition condition)
+    List<String> getUsersFromCondition (PolicyCondition condition)
             throws KustvaktException;
 
+
     /**
      * @param policy
      * @throws KustvaktException
      */
-    int removeParamBinding(SecurityPolicy policy) throws KustvaktException;
+    int removeParamBinding (SecurityPolicy policy) throws KustvaktException;
 
-    int size();
+
+    int size ();
 
 }
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 6666d49..f13e254 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,32 +11,38 @@
 
 // todo: for transaction to work this should go into core module!?!
 // todo: user instance only required for auditing pointcut operations
-public interface ResourceOperationIface<T extends KustvaktResource>
-        extends KustvaktTypeInterface<T>, KustvaktBaseDaoInterface {
+public interface ResourceOperationIface<T extends KustvaktResource> extends
+        KustvaktTypeInterface<T>, KustvaktBaseDaoInterface {
 
-    <T extends KustvaktResource> T findbyId(String id, User user)
+    <T extends KustvaktResource> T findbyId (String id, User user)
             throws KustvaktException;
 
-    <T extends KustvaktResource> T findbyId(Integer id, User user)
+
+    <T extends KustvaktResource> T findbyId (Integer id, User user)
             throws KustvaktException;
 
-    List<T> getResources(Collection<Object> ids, User user)
+
+    List<T> getResources (Collection<Object> ids, User user)
             throws KustvaktException;
 
-    int updateResource(T resource, User user) throws KustvaktException;
 
-    int[] updateResources(List<T> resources, User user)
+    int updateResource (T resource, User user) throws KustvaktException;
+
+
+    int[] updateResources (List<T> resources, User user)
             throws KustvaktException;
 
+
     /**
      * store a resource and return the id of the inserted value
-     *
+     * 
      * @param resource
      * @return
      * @throws KustvaktException
      */
-    int storeResource(T resource, User user) throws KustvaktException;
+    int storeResource (T resource, User user) throws KustvaktException;
+
 
     //    public void deleteResource(Integer id, User user) throws KorAPException;
-    int deleteResource(String id, User user) throws KustvaktException;
+    int deleteResource (String id, User user) throws KustvaktException;
 }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java b/src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java
index e1812ff..5b0cf0e 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/db/UserDataDbIface.java
@@ -10,16 +10,21 @@
  */
 public interface UserDataDbIface<T extends Userdata> {
 
-    public int store(T data) throws KustvaktException;
+    public int store (T data) throws KustvaktException;
 
-    public int update(T data) throws KustvaktException;
 
-    public T get(Integer id) throws KustvaktException;
+    public int update (T data) throws KustvaktException;
 
-    public T get(User user) throws KustvaktException;
 
-    public int delete(T data) throws KustvaktException;
+    public T get (Integer id) throws KustvaktException;
 
-    public int deleteAll() 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/interfaces/defaults/DefaultAuditing.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultAuditing.java
index ef76c8c..86e533e 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultAuditing.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultAuditing.java
@@ -23,58 +23,68 @@
 
     private FileOutputStream stream;
 
-    public DefaultAuditing() {
+
+    public DefaultAuditing () {
         try {
             File f = new File("logs");
             f.mkdirs();
             stream = new FileOutputStream(new File(f, "default_audit.log"));
-        }catch (FileNotFoundException e) {
+        }
+        catch (FileNotFoundException e) {
             e.printStackTrace();
         }
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(
+    public <T extends AuditRecord> List<T> retrieveRecords (
             AuditRecord.CATEGORY category, DateTime day, DateTime until,
             boolean exact, int limit) {
         throw new UnsupportedOperationException("Operation not supported!");
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(
+    public <T extends AuditRecord> List<T> retrieveRecords (
             AuditRecord.CATEGORY category, User user, int limit) {
         throw new UnsupportedOperationException("Operation not supported!");
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(LocalDate day,
+    public <T extends AuditRecord> List<T> retrieveRecords (LocalDate day,
             int hitMax) {
         throw new UnsupportedOperationException("Operation not supported!");
     }
 
+
     @Override
-    public <T extends AuditRecord> List<T> retrieveRecords(String userID,
+    public <T extends AuditRecord> List<T> retrieveRecords (String userID,
             LocalDate start, LocalDate end, int hitMax) {
         throw new UnsupportedOperationException("Operation not supported!");
     }
 
+
     @Override
-    public void apply() {
+    public void apply () {
         List<AuditRecord> rcs = getRecordsToSave();
         try {
             for (AuditRecord r : rcs)
                 stream.write((r.toString() + "\n").getBytes());
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             e.printStackTrace();
         }
     }
 
+
     @Override
-    public void finish() {
+    public void finish () {
         try {
             stream.flush();
             stream.close();
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             e.printStackTrace();
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
index 108188e..96d5c52 100644
--- a/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
+++ b/src/main/java/de/ids_mannheim/korap/interfaces/defaults/DefaultEncryption.java
@@ -21,77 +21,91 @@
 
     private SecureRandom randomizer;
 
-    public DefaultEncryption() {
+
+    public DefaultEncryption () {
         randomizer = new SecureRandom();
     }
 
+
     @Override
-    public String produceSecureHash(String input, String salt)
+    public String produceSecureHash (String input, String salt)
             throws NoSuchAlgorithmException, UnsupportedEncodingException,
             KustvaktException {
         return null;
     }
 
+
     @Override
-    public String produceSecureHash(String input)
+    public String produceSecureHash (String input)
             throws NoSuchAlgorithmException, UnsupportedEncodingException,
             KustvaktException {
         return null;
     }
 
+
     @Override
-    public String hash(String text, String salt) throws Exception {
+    public String hash (String text, String salt) throws Exception {
         return null;
     }
 
+
     @Override
-    public String hash(String value) {
+    public String hash (String value) {
         return null;
     }
 
+
     @Override
-    public boolean checkHash(String plain, String hash, String salt) {
+    public boolean checkHash (String plain, String hash, String salt) {
         return false;
     }
 
+
     @Override
-    public boolean checkHash(String plain, String hash) {
+    public boolean checkHash (String plain, String hash) {
         return false;
     }
 
+
     @Override
-    public String getSalt(User user) {
+    public String getSalt (User user) {
         return null;
     }
 
+
     @Override
-    public String createToken(boolean hash, Object... obj) {
+    public String createToken (boolean hash, Object ... obj) {
         return createToken();
 
     }
 
+
     @Override
-    public String createToken() {
+    public String createToken () {
         return new BigInteger(100, randomizer).toString(20);
     }
 
+
     @Override
-    public String createID(Object... obj) {
+    public String createID (Object ... obj) {
         return createToken();
     }
 
+
     @Override
-    public String encodeBase() {
+    public String encodeBase () {
         return null;
     }
 
+
     @Override
-    public Map validateMap(Map map) throws KustvaktException {
+    public Map validateMap (Map map) throws KustvaktException {
         return null;
     }
 
+
     @Override
-    public String validateEntry(String input, String type)
+    public String validateEntry (String input, String type)
             throws KustvaktException {
         return input;
     }
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 1707616..632b0e4 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
@@ -43,7 +43,8 @@
     private final Randomizer randomizer;
     private KustvaktConfiguration config;
 
-    public KustvaktEncryption(KustvaktConfiguration config) {
+
+    public KustvaktEncryption (KustvaktConfiguration config) {
         jlog.info("initializing KorAPEncryption implementation");
         this.nullable = false;
         this.validator = DefaultValidator.getInstance();
@@ -51,7 +52,8 @@
         this.config = config;
     }
 
-    public static boolean matchTokenByteCode(Object param) {
+
+    public static boolean matchTokenByteCode (Object param) {
         if (!(param instanceof String))
             return false;
         String token = (String) param;
@@ -59,34 +61,41 @@
         return 64 == bytes.length;
     }
 
-    private String encodeBase(byte[] bytes) throws EncoderException {
+
+    private String encodeBase (byte[] bytes) throws EncoderException {
         return Base64.encodeBase64String(bytes);
     }
 
+
     @Override
-    public String encodeBase() {
+    public String encodeBase () {
         try {
             return encodeBase(this.createSecureRandom(24));
-        }catch (EncoderException e) {
+        }
+        catch (EncoderException e) {
             return "";
         }
     }
 
-    public String produceSecureHash(String input) {
+
+    public String produceSecureHash (String input) {
         return produceSecureHash(input, "");
     }
 
+
     @Override
-    public String produceSecureHash(String input, String salt) {
+    public String produceSecureHash (String input, String salt) {
         String hashString = "";
         switch (config.getEncryption()) {
             case ESAPICYPHER:
                 try {
                     hashString = hash(input, salt);
-                }catch (NoSuchAlgorithmException e) {
+                }
+                catch (NoSuchAlgorithmException e) {
                     jlog.error("there was an encryption error!", e);
                     return null;
-                }catch (Exception e) {
+                }
+                catch (Exception e) {
                     jlog.error("there was an error!", e);
                     return null;
                 }
@@ -99,7 +108,8 @@
 
                     for (byte b : digest)
                         hashString += String.format("%02x", b);
-                }catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
+                }
+                catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
                     e.printStackTrace();
                 }
                 break;
@@ -113,7 +123,8 @@
         return hashString;
     }
 
-    public String hash(String text, String salt) throws Exception {
+
+    public String hash (String text, String salt) throws Exception {
         byte[] bytes;
 
         MessageDigest md = MessageDigest.getInstance(ALGORITHM);
@@ -131,16 +142,19 @@
         return coding;
     }
 
+
     @Override
-    public String hash(String input) {
+    public String hash (String input) {
         String hashString = "";
         MessageDigest md;
         try {
             md = MessageDigest.getInstance("SHA-256");
             md.update(input.getBytes("UTF-8"));
-        }catch (NoSuchAlgorithmException e) {
+        }
+        catch (NoSuchAlgorithmException e) {
             return "";
-        }catch (UnsupportedEncodingException e) {
+        }
+        catch (UnsupportedEncodingException e) {
             return "";
         }
 
@@ -152,8 +166,10 @@
         return hashString;
     }
 
+
     /**
-     * // some sort of algorithm to create token and isSystem regularly the integrity
+     * // some sort of algorithm to create token and isSystem
+     * regularly the integrity
      * // of the token
      * public String createAuthToken() {
      * final byte[] rNumber = SecureRGenerator
@@ -161,19 +177,21 @@
      * String hash;
      * try {
      * hash = produceSimpleHash(SecureRGenerator.toHex(rNumber));
-     * } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+     * } catch (NoSuchAlgorithmException |
+     * UnsupportedEncodingException e) {
      * return "";
      * }
      * return hash;
      * }
      */
 
-    private byte[] createSecureRandom(int size) {
+    private byte[] createSecureRandom (int size) {
         return SecureRGenerator.getNextSecureRandom(size);
     }
 
+
     @Override
-    public String createToken(boolean hash, Object... obj) {
+    public String createToken (boolean hash, Object ... obj) {
         StringBuffer b = new StringBuffer();
         try {
             for (Object o : obj) {
@@ -184,41 +202,45 @@
                 return encodeBase(hash(b.toString().trim()).getBytes());
             else
                 return encodeBase(b.toString().trim().getBytes());
-        }catch (EncoderException e) {
+        }
+        catch (EncoderException e) {
             return "";
         }
 
     }
 
+
     @Override
-    public String createToken() {
+    public String createToken () {
         String encoded;
-        String v = randomizer
-                .getRandomString(SecureRGenerator.TOKEN_RANDOM_SIZE,
-                        SecureRGenerator.toHex(createSecureRandom(64))
-                                .toCharArray());
+        String v = randomizer.getRandomString(
+                SecureRGenerator.TOKEN_RANDOM_SIZE,
+                SecureRGenerator.toHex(createSecureRandom(64)).toCharArray());
         encoded = hash(v);
         jlog.trace("creating new token {}", encoded);
         return encoded;
     }
 
+
     @Override
-    public String createID(Object... obj) {
+    public String createID (Object ... obj) {
         final byte[] rNumber = SecureRGenerator
                 .getNextSecureRandom(SecureRGenerator.CORPUS_RANDOM_SIZE);
         if (obj.length != 0) {
             ArrayList s = new ArrayList();
             Collections.addAll(s, obj);
             obj = s.toArray();
-        }else {
+        }
+        else {
             obj = new Object[1];
             obj[0] = rNumber;
         }
         return createToken(false, obj);
     }
 
+
     @Override
-    public boolean checkHash(String plain, String hash, String salt) {
+    public boolean checkHash (String plain, String hash, String salt) {
         String pw = "";
         switch (config.getEncryption()) {
             case ESAPICYPHER:
@@ -227,7 +249,8 @@
             case BCRYPT:
                 try {
                     return BCrypt.checkpw(plain, hash);
-                }catch (IllegalArgumentException e) {
+                }
+                catch (IllegalArgumentException e) {
                     return false;
                 }
             case SIMPLE:
@@ -237,15 +260,17 @@
         return pw.equals(hash);
     }
 
+
     @Override
-    public boolean checkHash(String plain, String hash) {
+    public boolean checkHash (String plain, String hash) {
         switch (config.getEncryption()) {
             case ESAPICYPHER:
                 return produceSecureHash(plain).equals(hash);
             case BCRYPT:
                 try {
                     return BCrypt.checkpw(plain, hash);
-                }catch (IllegalArgumentException e) {
+                }
+                catch (IllegalArgumentException e) {
                     return false;
                 }
             case SIMPLE:
@@ -254,16 +279,19 @@
         return false;
     }
 
+
     @Override
-    public String getSalt(User user) {
+    public String getSalt (User user) {
         Class u = user.getClass();
         Field field;
         try {
             field = u.getSuperclass().getDeclaredField(PASSWORD_SALT_FIELD);
-        }catch (NoSuchFieldException e) {
+        }
+        catch (NoSuchFieldException e) {
             try {
                 field = u.getDeclaredField(PASSWORD_SALT_FIELD);
-            }catch (NoSuchFieldException e1) {
+            }
+            catch (NoSuchFieldException e1) {
                 // do nothing
                 e.printStackTrace();
                 return null;
@@ -274,16 +302,18 @@
             String value = String.valueOf(field.get(user));
             field.setAccessible(false);
             return value;
-        }catch (IllegalAccessException e) {
+        }
+        catch (IllegalAccessException e) {
             // do nothing
             e.printStackTrace();
         }
         return null;
     }
 
+
     // todo: where applied?
     @Override
-    public Map<String, Object> validateMap(Map<String, Object> map)
+    public Map<String, Object> validateMap (Map<String, Object> map)
             throws KustvaktException {
         Map<String, Object> safeMap = new HashMap<>();
         KustvaktMap kmap = new KustvaktMap(map);
@@ -294,13 +324,15 @@
                     String value = validateEntry(kmap.get(key), key);
                     safeMap.put(key, value);
                 }
-            }else {
+            }
+            else {
                 for (String key : kmap.keySet()) {
                     Object value = kmap.getRaw(key);
                     if (value instanceof String) {
                         value = validateEntry((String) value, key);
 
-                    }else if (value instanceof List) {
+                    }
+                    else if (value instanceof List) {
                         List list = (List) value;
                         for (Object v : list) {
                             if (v instanceof String)
@@ -319,13 +351,15 @@
         return safeMap;
     }
 
+
     @Deprecated
-    private String validateString(String descr, String input, String type,
+    private String validateString (String descr, String input, String type,
             int length, boolean nullable) throws KustvaktException {
         String s;
         try {
             s = validator.getValidInput(descr, input, type, length, nullable);
-        }catch (ValidationException e) {
+        }
+        catch (ValidationException e) {
             jlog.error(
                     "String value did not validate ('{}') with validation type {}",
                     new Object[] { input, type, e.getMessage() });
@@ -335,8 +369,9 @@
         return s;
     }
 
+
     @Override
-    public String validateEntry(String input, String type)
+    public String validateEntry (String input, String type)
             throws KustvaktException {
         try {
             if (type != null) {
@@ -345,32 +380,34 @@
                     jlog.debug("validating email entry '{}'", input.hashCode());
                     return validator.getValidInput("Email", input, "email",
                             config.getValidationEmaillength(), false);
-                }else if (type.equals(Attributes.USERNAME)) {
+                }
+                else if (type.equals(Attributes.USERNAME)) {
                     jlog.debug("validating username entry '{}'",
                             input.hashCode());
-                    return validator
-                            .getValidInput("Username", input, "username",
-                                    config.getValidationEmaillength(), false);
-                }else if (type.equals(Attributes.IP_RANG)) {
+                    return validator.getValidInput("Username", input,
+                            "username", config.getValidationEmaillength(),
+                            false);
+                }
+                else if (type.equals(Attributes.IP_RANG)) {
                     jlog.debug("validating ip address entry '{}'",
                             input.hashCode());
-                    return validator
-                            .getValidInput("IP Address", input, "ipaddress",
-                                    config.getValidationStringLength(),
-                                    nullable);
-                }else if (type.equals(Attributes.PASSWORD)) {
+                    return validator.getValidInput("IP Address", input,
+                            "ipaddress", config.getValidationStringLength(),
+                            nullable);
+                }
+                else if (type.equals(Attributes.PASSWORD)) {
                     jlog.debug("validating password entry '{}'",
                             input.hashCode());
-                    return validator
-                            .getValidInput("Password", input, "password",
-                                    config.getValidationStringLength(),
-                                    nullable);
+                    return validator.getValidInput("Password", input,
+                            "password", config.getValidationStringLength(),
+                            nullable);
                 }
             }
             jlog.debug("validating string entry '{}'", input.hashCode());
             return validator.getValidInput("Safe String", input, "SafeString",
                     config.getValidationStringLength(), nullable);
-        }catch (ValidationException ex) {
+        }
+        catch (ValidationException ex) {
             jlog.error("Validation failed! Value '{}' with type '{}'",
                     new Object[] { input, type });
             throw new KustvaktException(StatusCodes.PARAMETER_VALIDATION_ERROR,
@@ -378,26 +415,28 @@
         }
     }
 
-    public void validate(Object instance) throws KustvaktException {
+
+    public void validate (Object instance) throws KustvaktException {
         if (instance == null)
             return;
         try {
             validateStringField(instance.getClass().getDeclaredFields(),
                     instance);
-            validateStringField(
-                    instance.getClass().getSuperclass().getDeclaredFields(),
-                    instance);
-        }catch (IllegalAccessException e) {
+            validateStringField(instance.getClass().getSuperclass()
+                    .getDeclaredFields(), instance);
+        }
+        catch (IllegalAccessException e) {
             jlog.error("object value did not validate", e.getMessage());
             throw new KustvaktException(StatusCodes.PARAMETER_VALIDATION_ERROR,
                     "object could not be validated", instance.toString());
         }
     }
 
+
     //FIXME: currently all sets are skipped during validation (since users should not be allowed to edit those sets anyway,
     //I think we will be safe here
     @Deprecated
-    private void validateStringField(Field[] fields, Object instance)
+    private void validateStringField (Field[] fields, Object instance)
             throws KustvaktException, IllegalAccessException {
         for (Field field : fields) {
             boolean priv = false;
@@ -406,8 +445,8 @@
                     priv = true;
                     field.setAccessible(true);
                 }
-                if (field.getName().equals("password") | Modifier
-                        .isFinal(field.getModifiers()))
+                if (field.getName().equals("password")
+                        | Modifier.isFinal(field.getModifiers()))
                     continue;
                 String val = (String) field.get(instance);
                 if (val != null) {
@@ -431,14 +470,16 @@
         }
     }
 
-    private String bcryptHash(String text, String salt) {
+
+    private String bcryptHash (String text, String salt) {
         if (salt == null || salt.isEmpty())
             salt = BCrypt.gensalt(config.getLoadFactor());
         return BCrypt.hashpw(text, salt);
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         return this.getClass().getCanonicalName();
     }
 
@@ -449,19 +490,21 @@
         protected static final int USERID_RANDOM_SIZE = 64;
         protected static final int CORPUS_RANDOM_SIZE = 48;
         private static final char[] HEX_DIGIT = { '0', '1', '2', '3', '4', '5',
-                '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'z', 'x', 'h',
-                'q', 'w' };
+                '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'z', 'x',
+                'h', 'q', 'w' };
         private static final SecureRandom sRandom__;
 
         static {
             try {
                 sRandom__ = SecureRandom.getInstance("SHA1PRNG");
-            }catch (NoSuchAlgorithmException e) {
+            }
+            catch (NoSuchAlgorithmException e) {
                 throw new Error(e);
             }
         }
 
-        public static byte[] getNextSecureRandom(int bits) {
+
+        public static byte[] getNextSecureRandom (int bits) {
             if (bits % 8 != 0) {
                 throw new IllegalArgumentException(
                         "Size is not divisible by 8!");
@@ -474,7 +517,8 @@
             return bytes;
         }
 
-        public static String toHex(byte[] bytes) {
+
+        public static String toHex (byte[] bytes) {
             if (bytes == null) {
                 return null;
             }
@@ -487,7 +531,8 @@
             return buffer.toString();
         }
 
-        private static String byteToHex(byte b) {
+
+        private static String byteToHex (byte b) {
             char[] array = { HEX_DIGIT[(b >> 4 & 0xF)], HEX_DIGIT[(b & 0xF)] };
             return new String(array);
         }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java b/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java
index 25bfd38..ebe4a2e 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java
@@ -13,25 +13,29 @@
     private Userdata settings;
     private KustvaktConfiguration config;
 
-    public LayerMapper(KustvaktConfiguration config, Userdata settings) {
+
+    public LayerMapper (KustvaktConfiguration config, Userdata settings) {
         this.settings = settings;
         this.config = config;
     }
 
-    public LayerMapper(KustvaktConfiguration config) {
+
+    public LayerMapper (KustvaktConfiguration config) {
         this.config = config;
     }
 
+
     /**
-     * find foundry entry in settings specific settings. Includes a call to #translateLayer to get the
+     * find foundry entry in settings specific settings. Includes a
+     * call to #translateLayer to get the
      * correct mapping for the layer denomination!
-     *
+     * 
      * @param layer
      * @return
      */
 
     //todo: make mapping configurable!
-    public String findFoundry(String layer) {
+    public String findFoundry (String layer) {
         if (settings != null) {
             switch (translateLayer(layer.toLowerCase().trim())) {
                 case "d":
@@ -53,7 +57,8 @@
                     // like orth or other tokenization layers
                     return "opennlp";
             }
-        }else {
+        }
+        else {
             switch (translateLayer(layer.toLowerCase().trim())) {
                 case "d":
                     return config.getDefault_dep();
@@ -65,7 +70,7 @@
                     return config.getDefault_lemma();
                 case "surface":
                     return config.getDefault_token();
-                // refers to "structure" and is used for paragraphs or sentence boundaries
+                    // refers to "structure" and is used for paragraphs or sentence boundaries
                 case "s":
                     return "base";
                 default:
@@ -76,16 +81,17 @@
         }
     }
 
+
     // relevance: map to access control id references. p is usually mapped to pos, l to lemma, etc.
-    public String translateLayer(String layer) {
+    public String translateLayer (String layer) {
         switch (layer.toLowerCase().trim()) {
-            //            case "pos":
-            //                return "p";
-            //            case "lemma":
-            //                return "l";
+        //            case "pos":
+        //                return "p";
+        //            case "lemma":
+        //                return "l";
             case "m":
                 return "msd";
-            //todo the orth layer does not need a foundry entry
+                //todo the orth layer does not need a foundry entry
             case "orth":
                 return "surface";
             case "t":
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanupFilter.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanupFilter.java
index f1c8500..14fcf15 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanupFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanupFilter.java
@@ -14,16 +14,16 @@
  * @author hanl
  * @date 28/07/2015
  */
-public class CollectionCleanupFilter
-        implements RewriteTask.RewriteNodeAt {
+public class CollectionCleanupFilter implements RewriteTask.RewriteNodeAt {
 
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         return process(node.rawNode());
     }
 
-    private JsonNode process(JsonNode root) {
+
+    private JsonNode process (JsonNode root) {
         JsonNode sub = root;
         if (root.isObject()) {
             if (root.has("operands")) {
@@ -40,9 +40,8 @@
                 // remove group element and replace with single doc
                 if (count == 1)
                     sub = node.path(0);
-                    // indicate empty group
-                else if (count
-                        == 0) // can't do anything here -- fixme: edge case?!
+                // indicate empty group
+                else if (count == 0) // can't do anything here -- fixme: edge case?!
                     return null;
             }
 
@@ -58,9 +57,10 @@
         return root;
     }
 
+
     // return null deletes node, if node return replace at level -1
     @Deprecated
-    private JsonNode processNodes(JsonNode jsonNode) {
+    private JsonNode processNodes (JsonNode jsonNode) {
         if (jsonNode.isObject()) {
             if (jsonNode.has("operands")) {
                 JsonNode node = jsonNode.at("/operands");
@@ -68,7 +68,8 @@
                 if (count == 1) {
                     // move to super node if any
                     return node.path(0);
-                }else if (count == 0) {
+                }
+                else if (count == 0) {
                     // remove container
                     return null;
                 }
@@ -78,13 +79,15 @@
         return JsonUtils.createArrayNode();
     }
 
+
     @Override
-    public JsonNode postProcess(KoralNode node) {
+    public JsonNode postProcess (KoralNode node) {
         return null;
     }
 
+
     @Override
-    public String at() {
+    public String at () {
         return "/collection";
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionConstraint.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionConstraint.java
index 8cd37e1..4173bbd 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionConstraint.java
@@ -14,11 +14,10 @@
  * @author hanl
  * @date 03/07/2015
  */
-public class CollectionConstraint
-        implements RewriteTask.IterableRewriteAt {
+public class CollectionConstraint implements RewriteTask.IterableRewriteAt {
 
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         if (node.get("@type").equals("koral:doc")) {
             if (node.get("key").equals("corpusID") && !check(node, user)) {
@@ -29,12 +28,13 @@
         return node.rawNode();
     }
 
+
     /**
      * @param node
      * @param user
      * @return boolean if true access granted
      */
-    private boolean check(KoralNode node, User user) {
+    private boolean check (KoralNode node, User user) {
         // todo: can be used to circumvent access control if public filter not applied
         if (user == null)
             return true;
@@ -45,19 +45,22 @@
             SecurityManager m = SecurityManager
                     .findbyId(id, user, Corpus.class);
             corpus = m.getResource();
-        }catch (RuntimeException | KustvaktException e) {
+        }
+        catch (RuntimeException | KustvaktException e) {
             return false;
         }
         return corpus != null;
     }
 
+
     @Override
-    public JsonNode postProcess(KoralNode node) {
+    public JsonNode postProcess (KoralNode node) {
         return null;
     }
 
+
     @Override
-    public String path() {
+    public String path () {
         return "collection";
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
index a15d536..fb4ba86 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/DocMatchRewrite.java
@@ -18,24 +18,27 @@
  * @date 12/11/2015
  */
 //todo : test
-public class DocMatchRewrite
-        implements RewriteTask.IterableRewriteAt, BeanInjectable {
+public class DocMatchRewrite implements RewriteTask.IterableRewriteAt,
+        BeanInjectable {
 
     private DocumentDao docDao;
     private Cache cache;
 
-    public DocMatchRewrite() {
+
+    public DocMatchRewrite () {
         this.cache = CacheManager.getInstance().getCache("documents");
     }
 
-    @Override
-    public void insertBeans(ContextHolder beans) {
-        this.docDao = BeansFactory.getTypeFactory()
-                .getTypedBean(beans.getResourceProvider(), Document.class);
-    }
 
     @Override
-    public JsonNode postProcess(KoralNode node) throws KustvaktException {
+    public void insertBeans (ContextHolder beans) {
+        this.docDao = BeansFactory.getTypeFactory().getTypedBean(
+                beans.getResourceProvider(), Document.class);
+    }
+
+
+    @Override
+    public JsonNode postProcess (KoralNode node) throws KustvaktException {
         Document doc = null;
         if (this.docDao == null)
             throw new RuntimeException("Document dao must be set!");
@@ -47,7 +50,8 @@
                 doc = docDao.findbyId(docID, null);
                 if (doc != null)
                     this.cache.put(new Element(docID, doc));
-            }else
+            }
+            else
                 doc = (Document) e.getObjectValue();
 
             if (doc != null && doc.isDisabled())
@@ -56,13 +60,15 @@
         return node.rawNode();
     }
 
+
     @Override
-    public String path() {
+    public String path () {
         return "matches";
     }
 
+
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         return null;
     }
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 1bb0174..19d4145 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
@@ -19,26 +19,28 @@
  * @author hanl
  * @date 30/06/2015
  */
-public class FoundryInject
-        implements RewriteTask.IterableRewriteAt, BeanInjectable {
+public class FoundryInject implements RewriteTask.IterableRewriteAt,
+        BeanInjectable {
 
     private Collection userdaos;
 
-    public FoundryInject() {
+
+    public FoundryInject () {
         this.userdaos = Collections.emptyList();
     }
 
 
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) throws KustvaktException {
         LayerMapper mapper;
 
         if (user != null && !userdaos.isEmpty()) {
-            UserDataDbIface dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(userdaos, UserSettings.class);
+            UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                    userdaos, UserSettings.class);
             mapper = new LayerMapper(config, dao.get(user));
-        }else
+        }
+        else
             mapper = new LayerMapper(config);
 
         if (node.get("@type").equals("koral:term") && !node.has("foundry")) {
@@ -53,18 +55,21 @@
         return node.rawNode();
     }
 
+
     @Override
-    public String path() {
+    public String path () {
         return "query";
     }
 
+
     @Override
-    public JsonNode postProcess(KoralNode node) {
+    public JsonNode postProcess (KoralNode node) {
         return null;
     }
 
+
     @Override
-    public <T extends ContextHolder> void insertBeans(T beans) {
+    public <T extends ContextHolder> void insertBeans (T beans) {
         this.userdaos = beans.getUserDataDaos();
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java
index 66c2e53..86026aa 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java
@@ -10,17 +10,18 @@
  * @author hanl
  * @date 25/09/2015
  */
-public class IdWriter
-        implements RewriteTask.RewriteKoralToken {
+public class IdWriter implements RewriteTask.RewriteKoralToken {
 
     private int counter;
 
-    public IdWriter() {
+
+    public IdWriter () {
         this.counter = 0;
     }
 
+
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         if (node.get("@type").equals("koral:token")) {
             String s = extractToken(node.rawNode());
@@ -30,8 +31,9 @@
         return node.rawNode();
     }
 
+
     // fixme: koral token --> how does grouping behave?!
-    private String extractToken(JsonNode token) {
+    private String extractToken (JsonNode token) {
         JsonNode wrap = token.path("wrap");
         if (!wrap.isMissingNode())
             return wrap.path("key").asText();
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
index 94dd6c7..fe3f6cb 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
@@ -20,25 +20,28 @@
     private boolean remove;
     private final String target;
 
-    private KoralNode(String target, JsonNode node) {
+
+    private KoralNode (String target, JsonNode node) {
         this.node = node;
         this.target = target;
         this.builder = new KoralRewriteBuilder();
         this.remove = false;
     }
 
-    public static KoralNode wrapNode(JsonNode node) {
-        return new KoralNode(null, node) {
-        };
+
+    public static KoralNode wrapNode (JsonNode node) {
+        return new KoralNode(null, node) {};
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         return this.node.toString();
     }
 
+
     @Deprecated
-    public boolean setNode(Object path) {
+    public boolean setNode (Object path) {
         JsonNode n = null;
         if (this.node.isObject() && this.node.has((String) path))
             n = this.node.path((String) path);
@@ -52,7 +55,8 @@
         return false;
     }
 
-    public void put(String name, Object value) {
+
+    public void put (String name, Object value) {
 
         if (this.node.isObject() && this.node.path(name).isMissingNode()) {
             ObjectNode node = (ObjectNode) this.node;
@@ -62,18 +66,21 @@
                 node.put(name, (Integer) value);
             builder.setOperation("injection");
             builder.build(this.node);
-        }else
+        }
+        else
             throw new UnsupportedOperationException(
                     "node doesn't support this operation");
     }
 
-    public void remove(Object identifier) {
+
+    public void remove (Object identifier) {
         boolean set = false;
         if (this.node.isObject() && identifier instanceof String) {
             ObjectNode n = (ObjectNode) this.node;
             n.remove((String) identifier);
             set = true;
-        }else if (this.node.isArray() && identifier instanceof Integer) {
+        }
+        else if (this.node.isArray() && identifier instanceof Integer) {
             ArrayNode n = (ArrayNode) this.node;
             n.remove((Integer) identifier);
             set = true;
@@ -84,7 +91,8 @@
         }
     }
 
-    public void replace(String name, String value) {
+
+    public void replace (String name, String value) {
         if (this.node.isObject() && this.node.has(name)) {
             ObjectNode n = (ObjectNode) this.node;
             n.put(name, value);
@@ -93,17 +101,20 @@
         }
     }
 
-    public String get(String name) {
+
+    public String get (String name) {
         if (this.node.isObject())
             return this.node.path(name).asText();
         return null;
     }
 
-    public JsonNode at(String name) {
+
+    public JsonNode at (String name) {
         return this.node.at(name);
     }
 
-    public boolean has(Object ident) {
+
+    public boolean has (Object ident) {
         if (ident instanceof String)
             return this.node.has((String) ident);
         else if (ident instanceof Integer)
@@ -111,19 +122,23 @@
         return false;
     }
 
-    public JsonNode rawNode() {
+
+    public JsonNode rawNode () {
         return this.node;
     }
 
-    public void removeNode() {
+
+    public void removeNode () {
         this.remove = true;
     }
 
-    public boolean isRemove() {
+
+    public boolean isRemove () {
         return this.remove;
     }
 
-    public final String target() {
+
+    public final String target () {
         return this.target;
     }
 
@@ -132,25 +147,29 @@
 
         private Map<String, String> map;
 
-        public KoralRewriteBuilder() {
+
+        public KoralRewriteBuilder () {
             this.map = new LinkedHashMap<>();
             this.map.put("@type", "koral:rewrite");
             this.map.put("src", "Kustvakt");
         }
 
-        public KoralRewriteBuilder setOperation(String op) {
+
+        public KoralRewriteBuilder setOperation (String op) {
             if (!op.startsWith("operation:"))
                 op = "operation:" + op;
             this.map.put("operation", op);
             return this;
         }
 
-        public KoralRewriteBuilder setScope(String scope) {
+
+        public KoralRewriteBuilder setScope (String scope) {
             this.map.put("scope", scope);
             return this;
         }
 
-        public JsonNode build(JsonNode node) {
+
+        public JsonNode build (JsonNode node) {
             if (this.map.get("operation") == null)
                 throw new UnsupportedOperationException(
                         "operation not set properly");
@@ -158,7 +177,8 @@
             if (node.has("rewrites")) {
                 ArrayNode n = (ArrayNode) node.path("rewrites");
                 n.add(JsonUtils.valueToTree(this.map));
-            }else {
+            }
+            else {
                 ObjectNode n = (ObjectNode) node;
                 List l = new LinkedList<>();
                 l.add(JsonUtils.valueToTree(this.map));
@@ -169,7 +189,3 @@
 
     }
 }
-
-
-
-
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java
index 4899fcf..3158af0 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java
@@ -9,12 +9,11 @@
  * @author hanl
  * @date 04/07/2015
  */
-public class MetaConstraint
-        implements RewriteTask.RewriteNodeAt {
+public class MetaConstraint implements RewriteTask.RewriteNodeAt {
 
 
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         // redundant
         if (node.rawNode().has("meta")) {
@@ -25,14 +24,15 @@
         return node.rawNode();
     }
 
+
     @Override
-    public JsonNode postProcess(KoralNode node) {
+    public JsonNode postProcess (KoralNode node) {
         return null;
     }
 
 
     @Override
-    public String at() {
+    public String at () {
         return "/meta";
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/PublicCollection.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/PublicCollection.java
index f6a847e..597a407 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/PublicCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/PublicCollection.java
@@ -15,16 +15,16 @@
  * @author hanl
  * @date 04/07/2015
  */
-public class PublicCollection
-        implements RewriteTask.RewriteNodeAt {
+public class PublicCollection implements RewriteTask.RewriteNodeAt {
 
-    public PublicCollection() {
+    public PublicCollection () {
         super();
     }
 
+
     // todo: where to inject the array node into? --> super group with and relation plus subgroup with ids and or operator
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         JsonNode subnode = node.rawNode();
         // todo: test
@@ -33,11 +33,12 @@
             //todo: inject public collection node
             if (user != null) {
                 try {
-                    ResourceFinder finder = ResourceFinder
-                            .init(user, Corpus.class);
+                    ResourceFinder finder = ResourceFinder.init(user,
+                            Corpus.class);
                     Set<String> ids = finder.getIds();
                     createNode(ids);
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     e.printStackTrace();
                     //todo: 20.10.15 - 21.10.15
                 }
@@ -46,19 +47,22 @@
         return subnode;
     }
 
+
     //todo: 20.10.15
-    private JsonNode createNode(Set<String> ids) {
+    private JsonNode createNode (Set<String> ids) {
         JsonNode node = CollectionQueryBuilder3.Utils.buildDocGroup();
         return node;
     }
 
+
     @Override
-    public JsonNode postProcess(KoralNode node) {
+    public JsonNode postProcess (KoralNode node) {
         return null;
     }
 
+
     @Override
-    public String at() {
+    public String at () {
         return "/collection";
     }
 
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 90bebd4..3569834 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
@@ -31,12 +31,14 @@
     private KustvaktConfiguration config;
     private ContextHolder beans;
 
-    public RewriteHandler(KustvaktConfiguration config) {
+
+    public RewriteHandler (KustvaktConfiguration config) {
         this();
         this.config = config;
     }
 
-    public RewriteHandler() {
+
+    public RewriteHandler () {
         this.node_processors = new HashSet<>();
         this.token_node_processors = new HashSet<>();
         this.query_processors = new HashSet<>();
@@ -45,7 +47,7 @@
     }
 
 
-    public void defaultRewriteConstraints() {
+    public void defaultRewriteConstraints () {
         this.add(FoundryInject.class);
         this.add(PublicCollection.class);
         this.add(IdWriter.class);
@@ -53,11 +55,13 @@
         this.add(CollectionCleanupFilter.class);
     }
 
-    public Set getFailedProcessors() {
+
+    public Set getFailedProcessors () {
         return this.failed_task_registration;
     }
 
-    public boolean addProcessor(RewriteTask rewriter) {
+
+    public boolean addProcessor (RewriteTask rewriter) {
         if (rewriter instanceof RewriteTask.RewriteKoralToken)
             return this.token_node_processors
                     .add((RewriteTask.RewriteKoralToken) rewriter);
@@ -72,8 +76,9 @@
         return false;
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         StringBuilder b = new StringBuilder();
         b.append("--------------------------");
         b.append("pre/post: " + this.node_processors.toString()).append("\n")
@@ -85,18 +90,22 @@
         return b.toString();
     }
 
+
     /**
-     * expects extended RewriteNode/Query class with empty default constructor
-     *
+     * expects extended RewriteNode/Query class with empty default
+     * constructor
+     * 
      * @param rewriter
-     * @return boolean if rewriter class was successfully added to rewrite handler!
+     * @return boolean if rewriter class was successfully added to
+     *         rewrite handler!
      */
-    public boolean add(Class<? extends RewriteTask> rewriter) {
+    public boolean add (Class<? extends RewriteTask> rewriter) {
         RewriteTask task;
         try {
             Constructor c = rewriter.getConstructor();
             task = (RewriteTask) c.newInstance();
-        }catch (NoSuchMethodException | InvocationTargetException
+        }
+        catch (NoSuchMethodException | InvocationTargetException
                 | IllegalAccessException | InstantiationException e) {
             this.failed_task_registration.add(rewriter);
             return false;
@@ -104,14 +113,15 @@
         return addProcessor(task);
     }
 
-    public void clear() {
+
+    public void clear () {
         this.node_processors.clear();
         this.query_processors.clear();
         this.token_node_processors.clear();
     }
 
-    private boolean process(String name, JsonNode root, User user,
-            boolean post) {
+
+    private boolean process (String name, JsonNode root, User user, boolean post) {
         if (root.isObject()) {
             if (root.has("operands")) {
                 JsonNode ops = root.at("/operands");
@@ -121,16 +131,19 @@
                     if (process(name, next, user, post))
                         it.remove();
                 }
-            }else if (root.path("@type").asText().equals("koral:token")) {
+            }
+            else if (root.path("@type").asText().equals("koral:token")) {
                 // todo: koral:token nodes cannot be flagged for deletion --> creates the possibility for empty koral:token nodes
                 processNode(name, KoralNode.wrapNode(root), user,
                         this.token_node_processors, post);
                 return process(name, root.path("wrap"), user, post);
-            }else {
+            }
+            else {
                 return processNode(name, KoralNode.wrapNode(root), user,
                         this.node_processors, post);
             }
-        }else if (root.isArray()) {
+        }
+        else if (root.isArray()) {
             Iterator<JsonNode> it = root.elements();
             while (it.hasNext()) {
                 JsonNode next = it.next();
@@ -141,9 +154,10 @@
         return false;
     }
 
-    private JsonNode process(JsonNode root, User user, boolean post) {
+
+    private JsonNode process (JsonNode root, User user, boolean post) {
         jlog.debug("Running rewrite process on query {}", root);
-        if (root!= null) {
+        if (root != null) {
             Iterator<Map.Entry<String, JsonNode>> it = root.fields();
             while (it.hasNext()) {
                 Map.Entry<String, JsonNode> next = it.next();
@@ -154,34 +168,39 @@
         return root;
     }
 
-    public JsonNode preProcess(JsonNode root, User user) {
+
+    public JsonNode preProcess (JsonNode root, User user) {
         return process(root, user, false);
     }
 
-    public String preProcess(String json, User user) {
+
+    public String preProcess (String json, User user) {
         return JsonUtils.toJSON(preProcess(JsonUtils.readTree(json), user));
     }
 
-    public JsonNode postProcess(JsonNode root, User user) {
+
+    public JsonNode postProcess (JsonNode root, User user) {
         return process(root, user, true);
     }
 
-    public String postProcess(String json, User user) {
+
+    public String postProcess (String json, User user) {
         return JsonUtils.toJSON(postProcess(JsonUtils.readTree(json), user));
     }
 
+
     /**
      * @param node
      * @param user
      * @param tasks
-     * @return boolean true if node is to be removed from parent! Only applies if parent is an array node
+     * @return boolean true if node is to be removed from parent! Only
+     *         applies if parent is an array node
      */
     // todo: integrate notifications into system!
-    private boolean processNode(String rootNode, KoralNode node, User user,
+    private boolean processNode (String rootNode, KoralNode node, User user,
             Collection<? extends RewriteTask> tasks, boolean post) {
         if (this.config == null)
-            throw new RuntimeException(
-                    "KustvaktConfiguration must be set!");
+            throw new RuntimeException("KustvaktConfiguration must be set!");
 
         for (RewriteTask task : tasks) {
             jlog.debug("running processor on node: " + node);
@@ -199,15 +218,16 @@
             }
             try {
                 if (!post && task instanceof RewriteTask.RewriteBefore) {
-                    ((RewriteTask.RewriteBefore) task)
-                            .preProcess(node, this.config, user);
-                }else if (task instanceof RewriteTask.RewriteAfter) {
+                    ((RewriteTask.RewriteBefore) task).preProcess(node,
+                            this.config, user);
+                }
+                else if (task instanceof RewriteTask.RewriteAfter) {
                     ((RewriteTask.RewriteAfter) task).postProcess(node);
                 }
-            }catch (KustvaktException e) {
-                jlog.error("Error in rewrite processor {} for node {}",
-                        task.getClass().getSimpleName(),
-                        node.rawNode().toString());
+            }
+            catch (KustvaktException e) {
+                jlog.error("Error in rewrite processor {} for node {}", task
+                        .getClass().getSimpleName(), node.rawNode().toString());
                 e.printStackTrace();
             }
             if (node.isRemove())
@@ -216,7 +236,8 @@
         return node.isRemove();
     }
 
-    private void processFixedNode(JsonNode node, User user,
+
+    private void processFixedNode (JsonNode node, User user,
             Collection<RewriteTask> tasks, boolean post) {
         for (RewriteTask task : tasks) {
             JsonNode next = node;
@@ -227,22 +248,23 @@
             }
             try {
                 if (!post && task instanceof RewriteTask.RewriteBefore)
-                    ((RewriteTask.RewriteBefore) task)
-                            .preProcess(KoralNode.wrapNode(next), this.config,
-                                    user);
+                    ((RewriteTask.RewriteBefore) task).preProcess(
+                            KoralNode.wrapNode(next), this.config, user);
                 else
-                    ((RewriteTask.RewriteAfter) task)
-                            .postProcess(KoralNode.wrapNode(next));
-            }catch (KustvaktException e) {
-                jlog.error("Error in rewrite processor {} for node {}",
-                        task.getClass().getSimpleName(), node.toString());
+                    ((RewriteTask.RewriteAfter) task).postProcess(KoralNode
+                            .wrapNode(next));
+            }
+            catch (KustvaktException e) {
+                jlog.error("Error in rewrite processor {} for node {}", task
+                        .getClass().getSimpleName(), node.toString());
                 e.printStackTrace();
             }
         }
     }
 
+
     @Override
-    public <T extends ContextHolder> void insertBeans(T beans) {
+    public <T extends ContextHolder> void insertBeans (T beans) {
         this.beans = beans;
         this.config = beans.getConfiguration();
     }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java
index 308f524..d9a3e4b 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java
@@ -13,68 +13,84 @@
 
     interface RewriteBefore extends RewriteTask {
         /**
-         * @param node   Json node in KoralNode wrapper
-         * @param config {@link KustvaktConfiguration} singleton instance to use default configuration parameters
-         * @param user   injected by rewrite handler if available. Might cause {@link NullPointerException} if not checked properly
+         * @param node
+         *            Json node in KoralNode wrapper
+         * @param config
+         *            {@link KustvaktConfiguration} singleton instance
+         *            to use default configuration parameters
+         * @param user
+         *            injected by rewrite handler if available. Might
+         *            cause {@link NullPointerException} if not
+         *            checked properly
          * @return
          */
-        JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+        JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
                 User user) throws KustvaktException;
 
     }
 
     /**
      * Post processor targeted at result sets for queries
-     * {@link de.ids_mannheim.korap.resource.rewrite.RewriteTask.RewriteAfter} queries will run
-     * after {@link de.ids_mannheim.korap.resource.rewrite.RewriteTask.IterableRewriteAt} have been processed
+     * {@link de.ids_mannheim.korap.resource.rewrite.RewriteTask.RewriteAfter}
+     * queries will run
+     * after
+     * {@link de.ids_mannheim.korap.resource.rewrite.RewriteTask.IterableRewriteAt}
+     * have been processed
      */
     interface RewriteAfter extends RewriteTask {
-        JsonNode postProcess(KoralNode node) throws KustvaktException;
+        JsonNode postProcess (KoralNode node) throws KustvaktException;
     }
 
     /**
      * nodes subject to rewrites at fixed json pointer location.
-     * Json-pointer based rewrites are processed after iterable rewrites
-     * Deletion via KoralNode not allowed. Supports pre- and post-processing
+     * Json-pointer based rewrites are processed after iterable
+     * rewrites
+     * Deletion via KoralNode not allowed. Supports pre- and
+     * post-processing
      */
     interface RewriteNodeAt extends RewriteBefore, RewriteAfter {
-        String at();
+        String at ();
     }
 
     /**
-     * terminal object nodes that are subject to rewrites through node iteration
+     * terminal object nodes that are subject to rewrites through node
+     * iteration
      * (both object and array node iteration supported)
      */
     interface IterableRewriteAt extends RewriteBefore, RewriteAfter {
-        String path();
+        String path ();
     }
 
     /**
      * koral token nodes that are subject to rewrites
-     * Be aware that node rewrites are processed before query rewrites. Thus query rewrite may override previous node rewrites
-     * {@link RewriteKoralToken} rewrite DOES NOT support the deletion of the respective node
+     * Be aware that node rewrites are processed before query
+     * rewrites. Thus query rewrite may override previous node
+     * rewrites {@link RewriteKoralToken} rewrite DOES NOT support the
+     * deletion of the respective node
      */
-    interface RewriteKoralToken extends RewriteBefore {
-    }
+    interface RewriteKoralToken extends RewriteBefore {}
 
     /**
-     * query rewrites get injected the entire query from root containing all child nodes
-     * <p/>
-     * {@link RewriteQuery} does not allow the deletion of the root node or subnode through KoralNode.
-     * The {@link de.ids_mannheim.korap.resource.rewrite.RewriteHandler} will igonore respecitve invalid requests
+     * query rewrites get injected the entire query from root
+     * containing all child nodes
+     * <p/> {@link RewriteQuery} does not allow the deletion of the
+     * root node or subnode through KoralNode.
+     * The
+     * {@link de.ids_mannheim.korap.resource.rewrite.RewriteHandler}
+     * will igonore respecitve invalid requests
      */
     @Deprecated
-    interface RewriteQuery extends RewriteBefore, RewriteAfter {
-    }
+    interface RewriteQuery extends RewriteBefore, RewriteAfter {}
 
     /**
      * Koral term nodes that are subject to rewrites
-     * Be aware that node rewrites are processed before query rewrites. Thus query rewrite may override previous node rewrites
-     * <p/>
-     * {@link RewriteNode} rewrite supports the deletion of the respective node by simply setting the node invalid in KoralNode
+     * Be aware that node rewrites are processed before query
+     * rewrites. Thus query rewrite may override previous node
+     * rewrites
+     * <p/> {@link RewriteNode} rewrite supports the deletion of the
+     * respective node by simply setting the node invalid in KoralNode
      */
     @Deprecated
-    interface RewriteNode extends RewriteBefore {
-    }
+    interface RewriteNode extends RewriteBefore {}
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java b/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java
index d569223..e4f134a 100644
--- a/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java
@@ -9,7 +9,8 @@
  * #ELEM(W ANA=N)
  * <p/>
  * {
- * "@context": "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
+ * "@context":
+ * "http://korap.ids-mannheim.de/ns/koral/0.3/context.jsonld",
  * "errors": [],
  * "warnings": [],
  * "messages": [],
@@ -30,43 +31,51 @@
  * <p/>
  * email reference:
  * Hallo Michael,
- * mir fiel gestern bei der neuen KoralQuery Serialisierung noch ein Fall
- * für default-Werte ein, die zumindest für viele Beispiele, die wir haben,
- * relevant ist: Wenn ein koral:term in einem koral:span gewrappt ist, dann
- * kann er eventuell nur einen Schlüssel haben ("s" oder "p" von "<s>" oder
- * "<p>". In diesem Fall wäre der default layer "s" und die default foundry
+ * mir fiel gestern bei der neuen KoralQuery Serialisierung noch ein
+ * Fall
+ * für default-Werte ein, die zumindest für viele Beispiele, die wir
+ * haben,
+ * relevant ist: Wenn ein koral:term in einem koral:span gewrappt ist,
+ * dann
+ * kann er eventuell nur einen Schlüssel haben ("s" oder "p" von "<s>"
+ * oder
+ * "<p>". In diesem Fall wäre der default layer "s" und die default
+ * foundry
  * "base". (Im alten KoralQuery wurden spans nicht gewrappt - der Fall
  * sollte aber erstmal weiter unterstützt werden.)
  * Viele Grüße,
  * Nils
- *
+ * 
  * @author hanl
  * @date 02/07/2015
  */
-public class TreeConstraint
-        implements RewriteTask.RewriteNodeAt {
+public class TreeConstraint implements RewriteTask.RewriteNodeAt {
 
     private String pointer;
 
-    public TreeConstraint() {
+
+    public TreeConstraint () {
         super();
     }
 
+
     @Override
-    public JsonNode preProcess(KoralNode node, KustvaktConfiguration config,
+    public JsonNode preProcess (KoralNode node, KustvaktConfiguration config,
             User user) {
         System.out.println("FIND PATH " + node.rawNode().findParent(pointer));
 
         return node.rawNode();
     }
 
+
     @Override
-    public JsonNode postProcess(KoralNode node) {
+    public JsonNode postProcess (KoralNode node) {
         return null;
     }
 
+
     @Override
-    public String at() {
+    public String at () {
         return null;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Corpus.java b/src/main/java/de/ids_mannheim/korap/resources/Corpus.java
index fdd9660..914fa1e 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Corpus.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Corpus.java
@@ -18,20 +18,24 @@
     @Deprecated
     private Map stats;
 
-    public Corpus() {
+
+    public Corpus () {
         super();
     }
 
-    public Corpus(String pers) {
+
+    public Corpus (String pers) {
         super(pers);
     }
 
-    public Corpus(Integer id) {
+
+    public Corpus (Integer id) {
         super(id);
     }
 
+
     @Override
-    public Map toMap() {
+    public Map toMap () {
         Map res = super.toMap();
         if (stats != null && !stats.isEmpty())
             res.put("statistics", stats);
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Document.java b/src/main/java/de/ids_mannheim/korap/resources/Document.java
index 3700a1b..9f86444 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Document.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Document.java
@@ -14,37 +14,39 @@
     private String corpus;
     private boolean disabled;
 
-    public Document(String persistentID) {
+
+    public Document (String persistentID) {
         this.setId(-1);
         this.setPersistentID(persistentID);
         this.corpus = getCorpusID();
         this.setDisabled(true);
     }
 
-    public Document(String persistentID, boolean disabled) {
+
+    public Document (String persistentID, boolean disabled) {
         this(persistentID);
         this.setDisabled(disabled);
     }
 
-    private String getCorpusID() {
+
+    private String getCorpusID () {
         //WPD_SSS.07367
         if (this.getPersistentID() != null)
             return this.getPersistentID().split("_")[0];
         return null;
     }
 
-    @Override
-    public String toString() {
-        return "Document{" +
-                "id='" + this.getId() + "'" +
-                "persistentid='" + this.getPersistentID() + "'" +
-                "corpus='" + corpus + '\'' +
-                ", disabled=" + disabled +
-                '}';
-    }
 
     @Override
-    public boolean equals(Object o) {
+    public String toString () {
+        return "Document{" + "id='" + this.getId() + "'" + "persistentid='"
+                + this.getPersistentID() + "'" + "corpus='" + corpus + '\''
+                + ", disabled=" + disabled + '}';
+    }
+
+
+    @Override
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (o == null || getClass() != o.getClass())
@@ -60,8 +62,9 @@
         return true;
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         int result = getPersistentID().hashCode();
         result = 31 * result + (disabled ? 1 : 0);
         return result;
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Foundry.java b/src/main/java/de/ids_mannheim/korap/resources/Foundry.java
index 11753d5..e2cba4d 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Foundry.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Foundry.java
@@ -6,15 +6,17 @@
  */
 public class Foundry extends KustvaktResource {
 
-    public Foundry() {
+    public Foundry () {
         super();
     }
 
-    public Foundry(Integer id) {
+
+    public Foundry (Integer id) {
         super(id);
     }
 
-    public Foundry(String persistentID) {
+
+    public Foundry (String persistentID) {
         super(persistentID);
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java b/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
index 7c25292..ebe6910 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/KustvaktResource.java
@@ -40,26 +40,30 @@
     @Getter(AccessLevel.PROTECTED)
     private Map<String, Object> fields;
 
-    public KustvaktResource() {
+
+    public KustvaktResource () {
         this.created = TimeUtils.getNow().getMillis();
         this.id = -1;
         this.parentID = null;
         this.fields = new HashMap<>();
     }
 
-    public KustvaktResource(Integer id) {
+
+    public KustvaktResource (Integer id) {
         this.created = TimeUtils.getNow().getMillis();
         this.id = id;
         this.parentID = null;
         this.fields = new HashMap<>();
     }
 
+
     // todo: move creator to builder instance for policies
-    public KustvaktResource(String persistentID) {
+    public KustvaktResource (String persistentID) {
         this();
         this.persistentID = persistentID;
     }
 
+
     //    public void setData(int type, Object data) {
     //        this.data = new Object[2];
     //        this.data[0] = type;
@@ -70,15 +74,17 @@
     //        return this.data != null ? (int) this.data[0] : -1;
     //    }
 
-    public void addField(String key, Object value) {
+    public void addField (String key, Object value) {
         this.fields.put(key, value);
     }
 
-    public void setFields(Map<String, Object> fields) {
+
+    public void setFields (Map<String, Object> fields) {
         this.fields = fields;
     }
 
-    public void setFields(String fields) {
+
+    public void setFields (String fields) {
         Map s = JsonUtils.readSimple(fields, Map.class);
         if (s == null)
             throw new RuntimeException(
@@ -87,53 +93,53 @@
         this.fields = s;
     }
 
-    public Object getField(String key) {
+
+    public Object getField (String key) {
         return this.fields.get(key);
     }
 
-    public String getData() {
+
+    public String getData () {
         return JsonUtils.toJSON(this.fields);
     }
 
-    @Override
-    public boolean equals(Object other) {
-        return other instanceof KustvaktResource && this.id
-                .equals(((KustvaktResource) other).getId());
-    }
 
     @Override
-    public int hashCode() {
+    public boolean equals (Object other) {
+        return other instanceof KustvaktResource
+                && this.id.equals(((KustvaktResource) other).getId());
+    }
+
+
+    @Override
+    public int hashCode () {
         int result = id.hashCode();
         return result;
     }
 
+
     /**
      * Merges another resource with this resource instance
-     * Every implementation of KorAPResource should override this method!
-     *
+     * Every implementation of KorAPResource should override this
+     * method!
+     * 
      * @param other
      */
-    public void merge(KustvaktResource other) {
+    public void merge (KustvaktResource other) {
         if (other == null)
             return;
 
-        this.setId(this.getId() == null || this.getId() == -1 ?
-                other.getId() :
-                other.getId());
-        this.setPersistentID(this.getPersistentID() == null ?
-                other.getPersistentID() :
-                this.getPersistentID());
-        this.setName(this.getName() == null || this.getName().isEmpty() ?
-                other.getName() :
-                this.getName());
-        this.setDescription(
-                this.getDescription() == null || this.getDescription()
-                        .isEmpty() ?
-                        other.getDescription() :
-                        this.getDescription());
-        this.setCreated(this.getCreated() < other.getCreated() ?
-                this.getCreated() :
-                other.getCreated());
+        this.setId(this.getId() == null || this.getId() == -1 ? other.getId()
+                : other.getId());
+        this.setPersistentID(this.getPersistentID() == null ? other
+                .getPersistentID() : this.getPersistentID());
+        this.setName(this.getName() == null || this.getName().isEmpty() ? other
+                .getName() : this.getName());
+        this.setDescription(this.getDescription() == null
+                || this.getDescription().isEmpty() ? other.getDescription()
+                : this.getDescription());
+        this.setCreated(this.getCreated() < other.getCreated() ? this
+                .getCreated() : other.getCreated());
         this.setPath(this.getPath() == null ? other.getPath() : this.getPath());
         //        this.setOwner(
         //                this.getOwner() == null ? other.getOwner() : this.getOwner());
@@ -142,26 +148,29 @@
         //        this.setShared(!this.isShared() ? other.isShared() : this.isShared());
     }
 
+
     /**
-     * Checks this instance for null parameter and replaces them with default values.
-     * Every implementation of KorAPResource should override this method!
-     *
+     * Checks this instance for null parameter and replaces them with
+     * default values.
+     * Every implementation of KorAPResource should override this
+     * method!
+     * 
      * @return
      */
-    public void checkNull() {
-        setCreated(this.getCreated() == 0L ?
-                TimeUtils.getNow().getMillis() :
-                this.getCreated());
+    public void checkNull () {
+        setCreated(this.getCreated() == 0L ? TimeUtils.getNow().getMillis()
+                : this.getCreated());
         setName(this.getName() == null ? "" : this.getName());
     }
 
+
     /**
      * this method is used to return field information about the class
      * All subclasses should override this method
-     *
+     * 
      * @return
      */
-    public Map toMap() {
+    public Map toMap () {
         Map m = new HashMap();
         m.put("id", persistentID);
         m.put("name", name);
@@ -176,15 +185,12 @@
         return m;
     }
 
+
     @Override
-    public String toString() {
-        return "Resource{" +
-                "id='" + id + '\'' +
-                "persistentID='" + persistentID + '\'' +
-                ", name='" + name + '\'' +
-                ", created=" + created +
-                ", path=" + path +
-                '}';
+    public String toString () {
+        return "Resource{" + "id='" + id + '\'' + "persistentID='"
+                + persistentID + '\'' + ", name='" + name + '\'' + ", created="
+                + created + ", path=" + path + '}';
     }
 
     //fixme: make private in respective areas
@@ -194,26 +200,30 @@
         private final String persistentID;
         private final boolean set;
 
-        public Container(String persistentID, Class type) {
+
+        public Container (String persistentID, Class type) {
             this.type = type;
             this.set = true;
             this.persistentID = persistentID;
         }
 
-        public Container(Class type) {
+
+        public Container (Class type) {
             this.type = type;
             this.set = true;
             this.persistentID = null;
         }
 
-        public Container() {
+
+        public Container () {
             this.set = false;
             this.type = null;
             this.persistentID = null;
         }
 
+
         @Override
-        public String toString() {
+        public String toString () {
             return persistentID + "@" + type.getSimpleName();
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Layer.java b/src/main/java/de/ids_mannheim/korap/resources/Layer.java
index 2dc411c..d8a2e09 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Layer.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Layer.java
@@ -6,27 +6,31 @@
  */
 public class Layer extends KustvaktResource {
 
-    public Layer() {
+    public Layer () {
         super();
     }
 
-    public Layer(Integer id, int creator) {
+
+    public Layer (Integer id, int creator) {
         super(id);
     }
 
+
     // layer name must not be unique!
-    public Layer(Integer id, String name) {
+    public Layer (Integer id, String name) {
         super(id);
         this.setName(name);
     }
 
-    public Layer(String persistentID, String name) {
+
+    public Layer (String persistentID, String name) {
         super(persistentID);
         this.setPersistentID(persistentID);
         this.setName(name);
     }
 
-    public Layer(String persistentID) {
+
+    public Layer (String persistentID) {
         super(persistentID);
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/resources/Permissions.java b/src/main/java/de/ids_mannheim/korap/resources/Permissions.java
index 0cdb37e..6f2c446 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/Permissions.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/Permissions.java
@@ -9,23 +9,23 @@
     public enum Permission {
 
         //fixme: add read_policy permission to allow read policy permissions
-        READ(Permissions.READ),
-        WRITE(Permissions.WRITE),
-        DELETE(Permissions.DELETE),
+        READ(Permissions.READ), WRITE(Permissions.WRITE), DELETE(
+                Permissions.DELETE),
 
-        READ_POLICY(Permissions.READ_POLICY),
-        CREATE_POLICY(Permissions.CREATE_POLICY),
-        MODIFY_POLICY(Permissions.MODIFY_POLICY),
-        DELETE_POLICY(Permissions.DELETE_POLICY),
-        ALL(Permissions.ALL);
+        READ_POLICY(Permissions.READ_POLICY), CREATE_POLICY(
+                Permissions.CREATE_POLICY), MODIFY_POLICY(
+                Permissions.MODIFY_POLICY), DELETE_POLICY(
+                Permissions.DELETE_POLICY), ALL(Permissions.ALL);
 
         private final byte b;
 
-        Permission(byte b) {
+
+        Permission (byte b) {
             this.b = b;
         }
 
-        public byte toByte() {
+
+        public byte toByte () {
             return this.b;
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java b/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java
index 48e4747..9458ffc 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/ResourceFactory.java
@@ -23,17 +23,20 @@
         //        subTypes.add(USERQUERY, UserQuery.class);
     }
 
-    public static KustvaktResource getResource(
+
+    public static KustvaktResource getResource (
             Class<? extends KustvaktResource> clazz) {
         try {
             return (KustvaktResource) clazz.newInstance();
-        }catch (InstantiationException | IllegalAccessException e) {
+        }
+        catch (InstantiationException | IllegalAccessException e) {
             // do nothing
         }
         return null;
     }
 
-    public static int getResourceMapping(Class<? extends KustvaktResource> r) {
+
+    public static int getResourceMapping (Class<? extends KustvaktResource> r) {
         int value = -1;
         if (r != null) {
             for (int i = 0; i < subTypes.size(); i++) {
@@ -44,11 +47,13 @@
         return value;
     }
 
-    public static KustvaktResource getResource(String type) {
+
+    public static KustvaktResource getResource (String type) {
         return getResource(getResourceClass(type));
     }
 
-    public static KustvaktResource getResource(int j) {
+
+    public static KustvaktResource getResource (int j) {
         Class s = subTypes.get(j);
         if (s != null) {
             return getResource(s);
@@ -56,37 +61,42 @@
         return null;
     }
 
-    public static <T extends KustvaktResource> T createID(T resource) {
+
+    public static <T extends KustvaktResource> T createID (T resource) {
         if (resource.getData() != null && !resource.getData().isEmpty())
             resource.setPersistentID(DigestUtils.sha1Hex(resource.getData()));
         return resource;
     }
 
-    public static <T extends KustvaktResource> Class<T> getResourceClass(
+
+    public static <T extends KustvaktResource> Class<T> getResourceClass (
             String type) {
         for (Class value : subTypes) {
-            if (value == VirtualCollection.class && type
-                    .equalsIgnoreCase("collection"))
+            if (value == VirtualCollection.class
+                    && type.equalsIgnoreCase("collection"))
                 return (Class<T>) VirtualCollection.class;
-                //todo
-                //            else if (value == UserQuery.class && type.equalsIgnoreCase("query"))
-                //                return (Class<T>) UserQuery.class;
+            //todo
+            //            else if (value == UserQuery.class && type.equalsIgnoreCase("query"))
+            //                return (Class<T>) UserQuery.class;
             else if (value.getSimpleName().equalsIgnoreCase(type.trim())) {
                 return value;
             }
         }
         return null;
     }
+
+
     // all deprecated!
 
-    public static VirtualCollection getCachedCollection(String query) {
+    public static VirtualCollection getCachedCollection (String query) {
         VirtualCollection v = new VirtualCollection(query);
         v.setName("");
         v.setDescription("");
         return v;
     }
 
-    public static VirtualCollection getPermanentCollection(
+
+    public static VirtualCollection getPermanentCollection (
             VirtualCollection mergable, String corpusName, String description) {
         VirtualCollection v = new VirtualCollection();
         v.merge(mergable);
@@ -95,6 +105,7 @@
         return createID(v);
     }
 
+
     //    public static VirtualCollection createCollection(String name, String query,
     //            Integer owner) {
     //        VirtualCollection v = new VirtualCollection(query);
@@ -130,7 +141,7 @@
     //        return v;
     //    }
 
-    public static VirtualCollection getIDContainer(Integer id) {
+    public static VirtualCollection getIDContainer (Integer id) {
         return new VirtualCollection(id);
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java b/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java
index 74ff1c8..cf87bff 100644
--- a/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java
+++ b/src/main/java/de/ids_mannheim/korap/resources/VirtualCollection.java
@@ -16,47 +16,49 @@
     @Deprecated
     private Map stats;
 
-    public VirtualCollection() {
+
+    public VirtualCollection () {
         super();
     }
 
-    public VirtualCollection(Integer id) {
+
+    public VirtualCollection (Integer id) {
         super(id);
     }
 
-    public VirtualCollection(String persistentID) {
+
+    public VirtualCollection (String persistentID) {
         super(persistentID);
     }
 
+
     @Override
-    public void merge(KustvaktResource resource) {
+    public void merge (KustvaktResource resource) {
         super.merge(resource);
         if (resource == null | !(resource instanceof VirtualCollection))
             return;
         VirtualCollection other = (VirtualCollection) resource;
-        this.setFields(this.getFields() == null ?
-                other.getFields() :
-                this.getFields());
+        this.setFields(this.getFields() == null ? other.getFields() : this
+                .getFields());
     }
 
+
     @Override
     @SuppressWarnings("unchecked")
-    public void checkNull() {
-        this.setDescription(
-                this.getDescription() == null ? "" : this.getDescription());
+    public void checkNull () {
+        this.setDescription(this.getDescription() == null ? "" : this
+                .getDescription());
         super.checkNull();
     }
 
+
     @Override
-    public String toString() {
-        return "VirtualCollection{" +
-                "id='" + this.getId() + '\'' +
-                ", persistentID='" + this.getPersistentID() + '\'' +
-                ", created=" + created +
-                ", path=" + this.getPath() +
-                ", name='" + this.getName() + '\'' +
-                ", data='" + this.getData() + '\'' +
-                '}';
+    public String toString () {
+        return "VirtualCollection{" + "id='" + this.getId() + '\''
+                + ", persistentID='" + this.getPersistentID() + '\''
+                + ", created=" + created + ", path=" + this.getPath()
+                + ", name='" + this.getName() + '\'' + ", data='"
+                + this.getData() + '\'' + '}';
     }
 
     //    @Override
diff --git a/src/main/java/de/ids_mannheim/korap/security/Parameter.java b/src/main/java/de/ids_mannheim/korap/security/Parameter.java
index 5f775ad..c27f0cf 100644
--- a/src/main/java/de/ids_mannheim/korap/security/Parameter.java
+++ b/src/main/java/de/ids_mannheim/korap/security/Parameter.java
@@ -16,29 +16,31 @@
     // todo: what is this supposed to do?
     private boolean equal;
 
-    public Parameter(String identifier, String value, boolean equal,
-            User user) {
+
+    public Parameter (String identifier, String value, boolean equal, User user) {
         super();
         super.setName(identifier.toLowerCase());
         this.value = value;
         this.equal = equal;
     }
 
-    @Override
-    public void merge(KustvaktResource resource) {
-    }
 
     @Override
-    public void checkNull() {
-    }
+    public void merge (KustvaktResource resource) {}
 
-    public String getValue() {
+
+    @Override
+    public void checkNull () {}
+
+
+    public String getValue () {
         if (policy == null)
             return null;
         return value;
     }
 
-    public void setPolicy(SecurityPolicy policy) {
+
+    public void setPolicy (SecurityPolicy policy) {
         this.policy = policy;
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/security/PermissionsBuffer.java b/src/main/java/de/ids_mannheim/korap/security/PermissionsBuffer.java
index 9c63a15..dc98264 100644
--- a/src/main/java/de/ids_mannheim/korap/security/PermissionsBuffer.java
+++ b/src/main/java/de/ids_mannheim/korap/security/PermissionsBuffer.java
@@ -15,33 +15,40 @@
 
     private byte[] bytes;
 
-    public PermissionsBuffer() {
+
+    public PermissionsBuffer () {
         this((short) 0);
     }
 
-    public PermissionsBuffer(short perm) {
+
+    public PermissionsBuffer (short perm) {
         setByte(perm);
     }
 
-    private void setByte(short perm) {
+
+    private void setByte (short perm) {
         ByteBuffer b = ByteBuffer.allocate(2);
         b.putShort(perm);
         bytes = b.array();
     }
 
-    public PermissionsBuffer(byte... bytes) {
+
+    public PermissionsBuffer (byte ... bytes) {
         this.bytes = bytes;
     }
 
-    public boolean containsPermission(Permissions.Permission p) {
+
+    public boolean containsPermission (Permissions.Permission p) {
         return containsPByte(p.toByte());
     }
 
-    public boolean containsPByte(byte perm) {
+
+    public boolean containsPByte (byte perm) {
         return (bytes[1] & perm) == perm;
     }
 
-    public int addPermission(int b) {
+
+    public int addPermission (int b) {
         short r = (short) (bytes[1] & b);
         if ((bytes[1] & b) != b)
             bytes[1] += b;
@@ -50,25 +57,29 @@
         return 0;
     }
 
-    public void retain(int compare) {
+
+    public void retain (int compare) {
         short f = (short) (bytes[1] & compare);
         ByteBuffer b = ByteBuffer.allocate(2);
         b.putShort(f);
         bytes = b.array();
     }
 
-    public void addPermissions(Permissions.Permission... perm) {
+
+    public void addPermissions (Permissions.Permission ... perm) {
         if (perm.length > 0) {
             for (Permissions.Permission p : perm)
                 addPermission(p.toByte());
         }
     }
 
-    public void removePermission(Permissions.Permission perm) {
+
+    public void removePermission (Permissions.Permission perm) {
         this.removePermission(perm.toByte());
     }
 
-    public int removePermission(int b) {
+
+    public int removePermission (int b) {
         if ((bytes[1] & b) != 0)
             bytes[1] -= b;
         else
@@ -76,8 +87,9 @@
         return 0;
     }
 
+
     @Deprecated
-    public int addOverride(int b) {
+    public int addOverride (int b) {
         if ((bytes[0] & b) == 0)
             bytes[0] += b;
         else
@@ -85,7 +97,8 @@
         return 0;
     }
 
-    public int removeOverride(int b) {
+
+    public int removeOverride (int b) {
         if ((bytes[0] & b) != 0)
             bytes[0] -= b;
         else
@@ -93,20 +106,23 @@
         return 0;
     }
 
+
     @Deprecated
-    public boolean isOverridable(int b) {
+    public boolean isOverridable (int b) {
         return (bytes[0] & b) != 0;
     }
 
-    public boolean leftShift(byte perm) {
+
+    public boolean leftShift (byte perm) {
         //        return pbyte & (perm << 1);
         System.out.println("pbyte is: " + bytes[1]);
         System.out.println("bitswise operation, left shift " + (perm << 1));
         return false;
     }
 
+
     @Override
-    public boolean equals(Object perm) {
+    public boolean equals (Object perm) {
         if (perm instanceof Byte)
             return (bytes[1] & (byte) perm) == bytes[1];
         else if (perm instanceof PermissionsBuffer) {
@@ -116,20 +132,24 @@
         return false;
     }
 
-    public short getBytes() {
+
+    public short getBytes () {
         ByteBuffer b = ByteBuffer.wrap(bytes);
         return b.getShort();
     }
 
-    public byte[] getByteArray() {
+
+    public byte[] getByteArray () {
         return bytes;
     }
 
-    public Byte getPbyte() {
+
+    public Byte getPbyte () {
         return this.bytes[1];
     }
 
-    public Set<Permissions.Permission> getPermissions() {
+
+    public Set<Permissions.Permission> getPermissions () {
         Set<Permissions.Permission> pe = new HashSet<>();
         for (Permissions.Permission p : Permissions.Permission.values()) {
             if (containsPByte(p.toByte()))
@@ -138,16 +158,17 @@
         return pe;
     }
 
-    public byte getOverride() {
+
+    public byte getOverride () {
         return this.bytes[0];
     }
 
-    public String toBinary() {
+
+    public String toBinary () {
         StringBuilder sb = new StringBuilder(bytes.length * Byte.SIZE);
         for (int i = 0; i < Byte.SIZE * bytes.length; i++) {
-            sb.append((bytes[i / Byte.SIZE] << i % Byte.SIZE & 0x80) == 0 ?
-                    '0' :
-                    '1');
+            sb.append((bytes[i / Byte.SIZE] << i % Byte.SIZE & 0x80) == 0 ? '0'
+                    : '1');
         }
         return sb.toString();
     }
diff --git a/src/main/java/de/ids_mannheim/korap/security/PolicyCondition.java b/src/main/java/de/ids_mannheim/korap/security/PolicyCondition.java
index 324ee8b..6ec5450 100644
--- a/src/main/java/de/ids_mannheim/korap/security/PolicyCondition.java
+++ b/src/main/java/de/ids_mannheim/korap/security/PolicyCondition.java
@@ -37,54 +37,64 @@
     private static final String EX_PRE = "ex:";
     private Map<String, Object> flags;
 
-    public PolicyCondition(String target) {
+
+    public PolicyCondition (String target) {
         // pattern to map extensionally created groups
         this.specifier = target;
         this.flags = new HashMap<>(stats);
     }
 
-    public PolicyCondition() {
+
+    public PolicyCondition () {
         this(EX_PRE + createGroupName());
     }
 
+
     @Deprecated
     //todo: do this in crypto bean!
-    private static String createGroupName() {
+    private static String createGroupName () {
         //        return Base64.encodeBase64String(SecureRGenerator
         //                .getNextSecureRandom(64));
         return "<new group name>";
     }
 
-    public void setDescription(String description) {
+
+    public void setDescription (String description) {
         this.description = description;
     }
 
-    public void setFlag(String key, Object value) {
+
+    public void setFlag (String key, Object value) {
         Object f = this.flags.get(key);
         if (f != null && f.getClass().equals(value.getClass()))
             this.flags.put(key, value);
     }
 
-    public String getSpecifier() {
+
+    public String getSpecifier () {
         return this.specifier;
     }
 
-    public boolean isExtensional() {
+
+    public boolean isExtensional () {
         return getSpecifier().startsWith(EX_PRE);
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         return "(" + this.specifier + ")";
     }
 
+
     @Override
-    public int compareTo(PolicyCondition o) {
+    public int compareTo (PolicyCondition o) {
         return this.getSpecifier().compareTo(o.getSpecifier());
     }
 
+
     @Override
-    public boolean equals(Object o) {
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (o == null || getClass() != o.getClass())
@@ -94,8 +104,9 @@
         return specifier.equals(that.specifier);
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         return specifier.hashCode();
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/security/PolicyContext.java b/src/main/java/de/ids_mannheim/korap/security/PolicyContext.java
index c4f41ca..00e3067 100644
--- a/src/main/java/de/ids_mannheim/korap/security/PolicyContext.java
+++ b/src/main/java/de/ids_mannheim/korap/security/PolicyContext.java
@@ -25,26 +25,30 @@
     private long end = 0L;
 
 
-    public PolicyContext() {
+    public PolicyContext () {
         start = TimeUtils.getNow().getMillis();
     }
 
-    public PolicyContext setIPMask(String ip) {
+
+    public PolicyContext setIPMask (String ip) {
         this.ipmask = ip;
         return this;
     }
 
-    public PolicyContext setExpirationTime(long limit) {
+
+    public PolicyContext setExpirationTime (long limit) {
         this.end = limit;
         return this;
     }
 
-    public PolicyContext setEnableTime(long start) {
+
+    public PolicyContext setEnableTime (long start) {
         this.start = start;
         return this;
     }
 
-    protected boolean isActive(String ipaddress) {
+
+    protected boolean isActive (String ipaddress) {
         if (ipaddress == null)
             return false;
         if (noMask())
@@ -54,22 +58,22 @@
             mask = IPNetMask.getIPMask(this.ipmask);
             boolean f = mask.matches(ipaddress);
             return f;
-        } catch (UnknownHostException e) {
+        }
+        catch (UnknownHostException e) {
             e.printStackTrace();
             return false;
         }
     }
 
-    protected boolean noMask() {
+
+    protected boolean noMask () {
         return ipmask == null || ipmask.isEmpty();
     }
 
+
     @Override
-    public String toString() {
-        return "PolicyContext{" +
-                ", ipmask='" + ipmask + '\'' +
-                ", start=" + start +
-                ", end=" + end +
-                '}';
+    public String toString () {
+        return "PolicyContext{" + ", ipmask='" + ipmask + '\'' + ", start="
+                + start + ", end=" + end + '}';
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/security/SecurityPolicy.java b/src/main/java/de/ids_mannheim/korap/security/SecurityPolicy.java
index 9539cb8..51d73d8 100644
--- a/src/main/java/de/ids_mannheim/korap/security/SecurityPolicy.java
+++ b/src/main/java/de/ids_mannheim/korap/security/SecurityPolicy.java
@@ -30,7 +30,8 @@
     private PolicyContext ctx;
     private Integer creator;
 
-    public SecurityPolicy() {
+
+    public SecurityPolicy () {
         this.setID(-1);
         this.ctx = new PolicyContext();
         this.conditions = new ArrayList<>();
@@ -39,71 +40,85 @@
         this.permissions = new PermissionsBuffer();
     }
 
-    public SecurityPolicy(Integer id) {
+
+    public SecurityPolicy (Integer id) {
         this();
         this.setID(id);
     }
 
-    public SecurityPolicy setID(Integer id) {
+
+    public SecurityPolicy setID (Integer id) {
         this.id = id;
         return this;
     }
 
-    public Integer getID() {
+
+    public Integer getID () {
         return this.id;
     }
 
-    public Integer getCreator() {
+
+    public Integer getCreator () {
         return this.creator;
     }
 
-    public PolicyContext getContext() {
+
+    public PolicyContext getContext () {
         return this.ctx;
     }
 
-    public SecurityPolicy setTarget(KustvaktResource resource) {
+
+    public SecurityPolicy setTarget (KustvaktResource resource) {
         this.target = resource.getPersistentID();
         return this;
     }
 
-    public SecurityPolicy setTarget(String target) {
+
+    public SecurityPolicy setTarget (String target) {
         this.target = target;
         return this;
     }
 
-    public String getTarget() {
+
+    public String getTarget () {
         return this.target;
     }
 
-    public SecurityPolicy setPOSIX(String posix) {
+
+    public SecurityPolicy setPOSIX (String posix) {
         this.permissions = new PermissionsBuffer(Short.valueOf(posix));
         return this;
     }
 
-    public SecurityPolicy setCreator(Integer creator) {
+
+    public SecurityPolicy setCreator (Integer creator) {
         this.creator = creator;
         return this;
     }
 
+
     // todo ???????
     @Deprecated
-    private SecurityPolicy setOverride(Permissions.Permission... perms) {
+    private SecurityPolicy setOverride (Permissions.Permission ... perms) {
         for (Permissions.Permission p : perms)
             this.permissions.addOverride(p.toByte());
         return this;
     }
 
-    public SecurityPolicy setContext(PolicyContext ctx) {
+
+    public SecurityPolicy setContext (PolicyContext ctx) {
         this.ctx = ctx;
         return this;
     }
 
-    private boolean hasContext() {
+
+    private boolean hasContext () {
         return !ctx.noMask();
     }
 
+
     //todo:
-    public boolean isActive(User user) {
+    public boolean isActive (User user) {
         System.out.println("THE POLICY " + this.toString());
         System.out.println("DOES THIS HAVE CONTEXT? " + this.hasContext());
         //        String host = (String) user.getField(Attributes.HOST);
@@ -114,7 +129,8 @@
         return !this.hasContext();
     }
 
-    public List<String> getConditionList() {
+
+    public List<String> getConditionList () {
         List<String> c = new LinkedList<>();
         Collections.sort(conditions);
         for (PolicyCondition p : conditions)
@@ -122,7 +138,8 @@
         return c;
     }
 
-    public String getConditionString() {
+
+    public String getConditionString () {
         if (conditions.isEmpty())
             return "";
 
@@ -136,11 +153,13 @@
         return b.toString();
     }
 
-    public List<PolicyCondition> getConditions() {
+
+    public List<PolicyCondition> getConditions () {
         return this.conditions;
     }
 
-    public SecurityPolicy setConditions(PolicyCondition... constraints) {
+
+    public SecurityPolicy setConditions (PolicyCondition ... constraints) {
         this.conditions.clear();
         this.removedidx.clear();
         this.addedidx.clear();
@@ -151,7 +170,8 @@
         return this;
     }
 
-    public SecurityPolicy removeCondition(PolicyCondition constraint) {
+
+    public SecurityPolicy removeCondition (PolicyCondition constraint) {
         int idx = this.conditions.indexOf(constraint);
         if (this.addedidx.contains(idx))
             this.addedidx.remove(idx);
@@ -160,30 +180,36 @@
         return this;
     }
 
-    public SecurityPolicy addCondition(PolicyCondition constraint) {
+
+    public SecurityPolicy addCondition (PolicyCondition constraint) {
         this.conditions.add(constraint);
         return this;
     }
 
-    public SecurityPolicy addNewCondition(PolicyCondition constraint) {
+
+    public SecurityPolicy addNewCondition (PolicyCondition constraint) {
         if (this.conditions.add(constraint))
             this.addedidx.add(this.conditions.indexOf(constraint));
         return this;
     }
 
-    public boolean contains(PolicyCondition constraint) {
+
+    public boolean contains (PolicyCondition constraint) {
         return conditions.contains(constraint);
     }
 
-    public Collection<Integer> getRemoved() {
+
+    public Collection<Integer> getRemoved () {
         return this.removedidx;
     }
 
-    public Collection<Integer> getAdded() {
+
+    public Collection<Integer> getAdded () {
         return this.addedidx;
     }
 
-    public void clear() {
+
+    public void clear () {
         // clear remove, add, conditions list!
         for (Integer remove : this.removedidx)
             this.conditions.remove(remove);
@@ -191,39 +217,45 @@
         this.addedidx.clear();
     }
 
-    public boolean hasPermission(Permissions.Permission perm) {
+
+    public boolean hasPermission (Permissions.Permission perm) {
         return permissions != null && permissions.containsPermission(perm);
     }
 
+
     /**
      * function to add a permission byte to the collection.
-     *
+     * 
      * @param perms
      * @return
      */
-    public SecurityPolicy addPermission(Permissions.Permission... perms) {
+    public SecurityPolicy addPermission (Permissions.Permission ... perms) {
         permissions.addPermissions(perms);
         return this;
     }
 
-    public boolean equalsPermission(Permissions.Permission... perms) {
+
+    public boolean equalsPermission (Permissions.Permission ... perms) {
         PermissionsBuffer b = new PermissionsBuffer();
         b.addPermissions(perms);
-        return permissions != null && permissions.getPbyte()
-                .equals(b.getPbyte());
+        return permissions != null
+                && permissions.getPbyte().equals(b.getPbyte());
     }
 
-    public void removePermission(Permissions.Permission perm) {
+
+    public void removePermission (Permissions.Permission perm) {
         if (permissions != null)
             permissions.removePermission(perm);
     }
 
-    public Byte getPermissionByte() {
+
+    public Byte getPermissionByte () {
         return permissions.getPbyte();
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         final StringBuffer sb = new StringBuffer("SecurityPolicy{");
         sb.append("id=").append(id);
         sb.append(", target='").append(target).append('\'');
@@ -233,12 +265,14 @@
         return sb.toString();
     }
 
-    public Set<Permissions.Permission> getPermissions() {
+
+    public Set<Permissions.Permission> getPermissions () {
         return permissions.getPermissions();
     }
 
+
     @Override
-    public boolean equals(Object o) {
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (o == null || getClass() != o.getClass())
@@ -254,8 +288,9 @@
         return true;
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         int result = id;
         result = 31 * result + target.hashCode();
         return result;
@@ -265,13 +300,15 @@
     public static class OwnerPolicy extends SecurityPolicy {
         private final Integer owner;
 
-        public OwnerPolicy(String target, Integer owner) {
+
+        public OwnerPolicy (String target, Integer owner) {
             this.owner = owner;
             super.setTarget(target);
         }
 
+
         @Override
-        public String toString() {
+        public String toString () {
             return "OwnerPolicy(" + super.getTarget() + "," + owner + ")";
         }
 
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java b/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java
index eab7b7f..d0db4fa 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ConditionManagement.java
@@ -25,15 +25,17 @@
     private User user;
     private PolicyHandlerIface policydao;
 
-    public ConditionManagement(User user) {
+
+    public ConditionManagement (User user) {
         this.user = user;
         this.policydao = BeanConfiguration.getBeans().getPolicyDbProvider();
 
     }
 
+
     /**
      * adds a user to an existing group
-     *
+     * 
      * @param usernames
      * @param condition
      * @param admin
@@ -41,58 +43,59 @@
     // todo: conflict resolution
     // fixme: not applicable to korap system roles
     // only works if there is a policy with that condition and permission set, if not, create one!
-    public void addUser(List<String> usernames, PolicyCondition condition,
+    public void addUser (List<String> usernames, PolicyCondition condition,
             boolean admin) throws NotAuthorizedException, KustvaktException {
-        if (policydao.matchCondition(this.user, condition.getSpecifier(), true)
-                == 1) {
+        if (policydao.matchCondition(this.user, condition.getSpecifier(), true) == 1) {
             policydao.addToCondition(usernames, condition, admin);
-        }else
+        }
+        else
             jlog.error("Users '{}' could not be added to condition '{}'",
                     usernames, condition.getSpecifier());
     }
 
-    public void addUser(String username, PolicyCondition condition,
+
+    public void addUser (String username, PolicyCondition condition,
             boolean admin) throws NotAuthorizedException, KustvaktException {
         addUser(Arrays.asList(username), condition, admin);
     }
 
-    public void removeUser(List<String> users, PolicyCondition condition)
+
+    public void removeUser (List<String> users, PolicyCondition condition)
             throws KustvaktException {
-        if (policydao.matchCondition(this.user, condition.getSpecifier(), true)
-                == 1) {
+        if (policydao.matchCondition(this.user, condition.getSpecifier(), true) == 1) {
             policydao.removeFromCondition(users, condition);
         }
     }
 
-    public Set<String> getMembers(PolicyCondition condition) {
+
+    public Set<String> getMembers (PolicyCondition condition) {
         try {
-            if (policydao
-                    .matchCondition(this.user, condition.getSpecifier(), true)
-                    == 1) {
-                return new HashSet<>(
-                        policydao.getUsersFromCondition(condition));
+            if (policydao.matchCondition(this.user, condition.getSpecifier(),
+                    true) == 1) {
+                return new HashSet<>(policydao.getUsersFromCondition(condition));
             }
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             return Collections.emptySet();
         }
         return Collections.emptySet();
     }
 
+
     @Deprecated
-    public void addUser(KustvaktResource resource, String user,
-            Permissions.Permission... pps)
-            throws NotAuthorizedException, KustvaktException,
-            EmptyResultException {
+    public void addUser (KustvaktResource resource, String user,
+            Permissions.Permission ... pps) throws NotAuthorizedException,
+            KustvaktException, EmptyResultException {
         addUser(resource, Arrays.asList(user), pps);
     }
 
+
     @Deprecated
-    public void addUser(KustvaktResource resource, List<String> users,
-            Permissions.Permission... pps)
-            throws NotAuthorizedException, KustvaktException,
-            EmptyResultException {
-        SecurityManager policies = SecurityManager
-                .findbyId(resource.getId(), this.user);
+    public void addUser (KustvaktResource resource, List<String> users,
+            Permissions.Permission ... pps) throws NotAuthorizedException,
+            KustvaktException, EmptyResultException {
+        SecurityManager policies = SecurityManager.findbyId(resource.getId(),
+                this.user);
         PolicyCondition c = policies.getExtensional(pps);
         if (c != null)
             this.addUser(users, c, false);
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java
index 8fff53c..fac7636 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyBuilder.java
@@ -29,7 +29,8 @@
     private Relation rel = null;
     private PolicyContext context;
 
-    public PolicyBuilder(User user) {
+
+    public PolicyBuilder (User user) {
         this.user = user;
         this.notifications = new Notifications();
         // fixme: other exception!?
@@ -37,32 +38,39 @@
             throw new RuntimeException("user id must be a valid interger id");
     }
 
-    public PolicyBuilder setResources(KustvaktResource... targets) {
+
+    public PolicyBuilder setResources (KustvaktResource ... targets) {
         this.resources = targets;
         this.parents = new KustvaktResource[targets.length];
         return this;
     }
 
+
     /**
-     * set the parents for the resources. Order is relevant, since the relation parent - resource is handled
-     * via the index within the array. Parent relation is limited to depth 1!
-     * In case of a skipped parent resource relation within the array, set 'null'
-     *
+     * set the parents for the resources. Order is relevant, since the
+     * relation parent - resource is handled
+     * via the index within the array. Parent relation is limited to
+     * depth 1!
+     * In case of a skipped parent resource relation within the array,
+     * set 'null'
+     * 
      * @param parents
      * @return
      */
-    public PolicyBuilder setParents(KustvaktResource... parents) {
+    public PolicyBuilder setParents (KustvaktResource ... parents) {
         for (int idx = 0; idx < parents.length; idx++)
             this.parents[idx] = parents[idx];
         return this;
     }
 
-    public PolicyBuilder setContext(PolicyContext context) {
+
+    public PolicyBuilder setContext (PolicyContext context) {
         this.context = context;
         return this;
     }
 
-    public PolicyBuilder setContext(long start, long end) {
+
+    public PolicyBuilder setContext (long start, long end) {
         if (this.context == null)
             this.context = new PolicyContext();
         this.context.setEnableTime(start);
@@ -70,50 +78,57 @@
         return this;
     }
 
-    public PolicyBuilder setLocation(String iprange) {
+
+    public PolicyBuilder setLocation (String iprange) {
         if (this.context == null)
             this.context = new PolicyContext();
         this.context.setIPMask(iprange);
         return this;
     }
 
-    public PolicyBuilder setPermissions(
-            Permissions.Permission... permissions) {
+
+    public PolicyBuilder setPermissions (Permissions.Permission ... permissions) {
         this.permissions = permissions;
         return this;
     }
 
-    public PolicyBuilder setConditions(String... conditions) {
+
+    public PolicyBuilder setConditions (String ... conditions) {
         this.conditions = new PolicyCondition[conditions.length];
         for (int idx = 0; idx < conditions.length; idx++)
             this.conditions[idx] = new PolicyCondition(conditions[idx]);
         return this;
     }
 
-    public PolicyBuilder setConditions(PolicyCondition... conditions) {
+
+    public PolicyBuilder setConditions (PolicyCondition ... conditions) {
         this.conditions = new PolicyCondition[conditions.length];
         for (int idx = 0; idx < conditions.length; idx++)
             this.conditions[idx] = conditions[idx];
         return this;
     }
 
-    public PolicyBuilder setRelation(Relation rel) {
+
+    public PolicyBuilder setRelation (Relation rel) {
         this.rel = rel;
         return this;
     }
 
-    public PolicyBuilder addCondition(String condition) {
+
+    public PolicyBuilder addCondition (String condition) {
         if (this.rel == null)
             setRelation(Relation.AND);
         return setConditions(condition);
     }
 
-    public String create() throws KustvaktException {
+
+    public String create () throws KustvaktException {
         return this.doIt();
     }
 
+
     // for and relations there is no way of setting parameters conjoined with the policy
-    private String doIt() throws KustvaktException {
+    private String doIt () throws KustvaktException {
         if (this.resources == null)
             throw new KustvaktException(user.getId(),
                     StatusCodes.ILLEGAL_ARGUMENT, "resource must be set",
@@ -133,8 +148,8 @@
             try {
                 if (parents[idx] != null)
                     resources[idx].setParentID(parents[idx].getPersistentID());
-                SecurityManager manager = SecurityManager
-                        .register(resources[idx], user);
+                SecurityManager manager = SecurityManager.register(
+                        resources[idx], user);
 
                 if (rel.equals(Relation.AND)) {
                     SecurityPolicy policy = new SecurityPolicy()
@@ -148,7 +163,8 @@
 
                     manager.addPolicy(policy);
 
-                }else if (rel.equals(Relation.OR)) {
+                }
+                else if (rel.equals(Relation.OR)) {
                     for (PolicyCondition c : this.conditions) {
                         SecurityPolicy policy = new SecurityPolicy()
                                 .addNewCondition(c).setTarget(resources[idx])
@@ -172,7 +188,8 @@
                         manager.addPolicy(policy);
                     }
                 }
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 this.notifications.addError(e.getStatusCode(), e.getMessage(),
                         resources[idx].getPersistentID());
             }
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
index 57d4658..e0e33ce 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyDao.java
@@ -44,10 +44,12 @@
 
     private NamedParameterJdbcTemplate jdbcTemplate;
 
-    public PolicyDao(PersistenceClient client) {
+
+    public PolicyDao (PersistenceClient client) {
         this.jdbcTemplate = (NamedParameterJdbcTemplate) client.getSource();
     }
 
+
     /**
      * @param policy
      * @param user
@@ -57,11 +59,10 @@
     // fixme: better way of dealing with this?
     // fixme: enable needs to be set specifically for mysql db
     @Override
-    public int createPolicy(SecurityPolicy policy, User user)
+    public int createPolicy (SecurityPolicy policy, User user)
             throws KustvaktException {
-        String sql =
-                "INSERT INTO policy_store (target_id, creator, created, posix, enable, expire, iprange)"
-                        + " SELECT id, :creator, :cr, :posix, :en, :exp, :ip FROM resource_store WHERE persistent_id=:target;";
+        String sql = "INSERT INTO policy_store (target_id, creator, created, posix, enable, expire, iprange)"
+                + " SELECT id, :creator, :cr, :posix, :en, :exp, :ip FROM resource_store WHERE persistent_id=:target;";
 
         if (policy.getTarget() == null)
             throw new dbException(user.getId(), "policy_store",
@@ -94,25 +95,29 @@
             policy.setID(keyHolder.getKey().intValue());
             this.mapConstraints(policy);
             return policy.getID();
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
-            jlog.error("Operation (INSERT) not possible for '{}' for user '{}'",
+            jlog.error(
+                    "Operation (INSERT) not possible for '{}' for user '{}'",
                     policy.toString(), user.getId());
             throw new dbException(user.getId(), "policy_store",
                     StatusCodes.DB_INSERT_FAILED, policy.toString());
         }
     }
 
+
     /**
-     * should also include a remove operation, so removed policy constraints
-     *
+     * should also include a remove operation, so removed policy
+     * constraints
+     * 
      * @param policy
      * @return
      * @throws KustvaktException
      */
     // benchmark this!
     @Override
-    public void mapConstraints(SecurityPolicy policy) throws KustvaktException {
+    public void mapConstraints (SecurityPolicy policy) throws KustvaktException {
         final String cond = "INSERT INTO group_ref (group_id, policy_id) VALUES (:group, :policyID);";
         final String remove = "DELETE FROM group_ref WHERE group_id=:group and policy_id=:policyID;";
         try {
@@ -123,8 +128,8 @@
                         .getRemoved().size()];
                 for (Integer toremove : policy.getRemoved()) {
                     MapSqlParameterSource source = new MapSqlParameterSource();
-                    source.addValue("group",
-                            conditions.get(toremove).getSpecifier());
+                    source.addValue("group", conditions.get(toremove)
+                            .getSpecifier());
                     source.addValue("policyID", policy.getID());
                     sources_removed[idx++] = source;
                 }
@@ -138,15 +143,15 @@
                         .getAdded().size()];
                 for (Integer add : policy.getAdded()) {
                     MapSqlParameterSource source = new MapSqlParameterSource();
-                    source.addValue("group",
-                            conditions.get(add).getSpecifier());
+                    source.addValue("group", conditions.get(add).getSpecifier());
                     source.addValue("policyID", policy.getID());
                     sources[idx++] = source;
                 }
                 this.jdbcTemplate.batchUpdate(cond, sources);
             }
             policy.clear();
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             e.printStackTrace();
             jlog.error(
                     "Operation (MAPPING POLICY CONDITIONS) not possible for '{}' for user '{}'",
@@ -157,8 +162,9 @@
         }
     }
 
+
     // todo: check transactional behaviour! --> rollback
-    private void mapConditionsToUsers(SecurityPolicy policy, User user)
+    private void mapConditionsToUsers (SecurityPolicy policy, User user)
             throws KustvaktException {
         for (PolicyCondition cond : policy.getConditions()) {
             MapSqlParameterSource param = new MapSqlParameterSource();
@@ -169,10 +175,10 @@
                 final Integer[] results = new Integer[2];
                 jdbcTemplate
                         .query("SELECT COUNT(*) as total, (select count(*) from group_users where user_id=:userid and "
-                                        + "group_id=:name) as users FROM group_store WHERE name=:name",
+                                + "group_id=:name) as users FROM group_store WHERE name=:name",
                                 param, new RowCallbackHandler() {
                                     @Override
-                                    public void processRow(ResultSet rs)
+                                    public void processRow (ResultSet rs)
                                             throws SQLException {
                                         results[0] = rs.getInt("total");
                                         results[1] = rs.getInt("users");
@@ -185,9 +191,10 @@
                     this.createCondition(cond, user);
                 }
                 if (results[1] == 0)
-                    this.addToCondition(Arrays.asList(user.getUsername()), cond,
-                            admin);
-            }catch (DataAccessException e) {
+                    this.addToCondition(Arrays.asList(user.getUsername()),
+                            cond, admin);
+            }
+            catch (DataAccessException e) {
                 jlog.error(
                         "Operation (SELECT) not possible for '{}' for user '{}'",
                         policy.getTarget(), user.getId());
@@ -197,9 +204,10 @@
         }
     }
 
+
     // fixme: does not compare permissions. parent can still disregard policy because of missing permisssions
     @Override
-    public List<SecurityPolicy>[] getPolicies(Integer target, final User user,
+    public List<SecurityPolicy>[] getPolicies (Integer target, final User user,
             Byte perm) {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("target", target);
@@ -207,34 +215,27 @@
         param.addValue("perm", perm);
         param.addValue("en", new Timestamp(TimeUtils.getNow().getMillis()));
 
-        String sql_new =
-                "select pv.*, pv.perm & :perm as allowed, rh.depth, (select max(depth) from resource_tree \n"
-                        +
-                        "where child_id=rh.child_id) as max_depth from policy_view as pv "
-                        +
-                        "inner join resource_tree as rh on rh.parent_id=pv.id "
-                        +
-                        "where rh.child_id=:target and pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
-                        +
-                        "(pv.group_id='self' or pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid)) and "
-                        +
-                        "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
-                        +
-                        "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id in (select g.group_id from group_users as g "
-                        +
-                        "where g.user_id=:userid) or pos.group_id='self') and res.child_id=rh.child_id group by child_id);";
+        String sql_new = "select pv.*, pv.perm & :perm as allowed, rh.depth, (select max(depth) from resource_tree \n"
+                + "where child_id=rh.child_id) as max_depth from policy_view as pv "
+                + "inner join resource_tree as rh on rh.parent_id=pv.id "
+                + "where rh.child_id=:target and pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
+                + "(pv.group_id='self' or pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid)) and "
+                + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
+                + "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id in (select g.group_id from group_users as g "
+                + "where g.user_id=:userid) or pos.group_id='self') and res.child_id=rh.child_id group by child_id);";
 
         try {
             return this.jdbcTemplate.query(sql_new, param,
                     new ResultSetExtractor<List<SecurityPolicy>[]>() {
 
                         @Override
-                        public List<SecurityPolicy>[] extractData(ResultSet rs)
+                        public List<SecurityPolicy>[] extractData (ResultSet rs)
                                 throws SQLException, DataAccessException {
                             return SecurityRowMappers.mapResourcePolicies(rs);
                         }
                     });
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error(
                     "Permission Denied for policy retrieval for '{}' for user '{}'",
                     target, user.getId());
@@ -242,49 +243,48 @@
         }
     }
 
+
     // without root policies, since these are policies from different resources!
     @Override
-    public List<SecurityPolicy> getPolicies(PolicyCondition condition,
+    public List<SecurityPolicy> getPolicies (PolicyCondition condition,
             Class<? extends KustvaktResource> clazz, Byte perm) {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("cond", condition.getSpecifier());
         param.addValue("perm", perm);
         param.addValue("type", ResourceFactory.getResourceMapping(clazz));
         param.addValue("en", new Timestamp(TimeUtils.getNow().getMillis()));
-        String sql_new = "select pv.*, pv.perm & :perm as allowed, " +
-                "rh.depth, (select max(depth) from resource_tree " +
-                "where child_id=rh.child_id) as max_depth from policy_view as pv "
-                +
-                "inner join resource_tree as rh on rh.parent_id=pv.id " +
-                "where " +
-                "pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
-                +
-                "pv.group_id=:cond and pv.type=:type and " +
-                "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
-                +
-                "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id=:cond)"
-                +
-                " and res.child_id=rh.child_id group by child_id)";
+        String sql_new = "select pv.*, pv.perm & :perm as allowed, "
+                + "rh.depth, (select max(depth) from resource_tree "
+                + "where child_id=rh.child_id) as max_depth from policy_view as pv "
+                + "inner join resource_tree as rh on rh.parent_id=pv.id "
+                + "where "
+                + "pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
+                + "pv.group_id=:cond and pv.type=:type and "
+                + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
+                + "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id=:cond)"
+                + " and res.child_id=rh.child_id group by child_id)";
 
         try {
             return this.jdbcTemplate.query(sql_new, param,
                     new ResultSetExtractor<List<SecurityPolicy>>() {
 
                         @Override
-                        public List<SecurityPolicy> extractData(ResultSet rs)
+                        public List<SecurityPolicy> extractData (ResultSet rs)
                                 throws SQLException, DataAccessException {
                             return SecurityRowMappers.mapConditionPolicies(rs);
                         }
                     });
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Permission Denied: policy retrieval for '{}'",
                     condition.getSpecifier());
             return Collections.emptyList();
         }
     }
 
+
     @Override
-    public List<SecurityPolicy>[] getPolicies(String target, final User user,
+    public List<SecurityPolicy>[] getPolicies (String target, final User user,
             Byte perm) {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("target", target);
@@ -292,35 +292,30 @@
         param.addValue("perm", perm);
         param.addValue("en", new Timestamp(TimeUtils.getNow().getMillis()));
 
-        String sql_new = "select pv.*, pv.perm & :perm as allowed, " +
-                "rh.depth, (select max(depth) from resource_tree " +
-                "where child_id=rh.child_id) as max_depth from policy_view as pv "
-                +
-                "inner join resource_tree as rh on rh.parent_id=pv.id " +
-                "where rh.child_id=(select id from resource_store where persistent_id=:target) and "
-                +
-                "pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
-                +
-                "(pv.group_id='self' or pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid)) and "
-                +
-                "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
-                +
-                "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id in (select g.group_id from group_users "
-                +
-                "as g where g.user_id=:userid) or pos.group_id='self') and res.child_id=rh.child_id group by child_id)";
+        String sql_new = "select pv.*, pv.perm & :perm as allowed, "
+                + "rh.depth, (select max(depth) from resource_tree "
+                + "where child_id=rh.child_id) as max_depth from policy_view as pv "
+                + "inner join resource_tree as rh on rh.parent_id=pv.id "
+                + "where rh.child_id=(select id from resource_store where persistent_id=:target) and "
+                + "pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
+                + "(pv.group_id='self' or pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid)) and "
+                + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
+                + "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id in (select g.group_id from group_users "
+                + "as g where g.user_id=:userid) or pos.group_id='self') and res.child_id=rh.child_id group by child_id)";
         try {
             return this.jdbcTemplate.query(sql_new, param,
                     new ResultSetExtractor<List<SecurityPolicy>[]>() {
 
                         @Override
-                        public List<SecurityPolicy>[] extractData(ResultSet rs)
+                        public List<SecurityPolicy>[] extractData (ResultSet rs)
                                 throws SQLException, DataAccessException {
                             List<SecurityPolicy>[] pol = SecurityRowMappers
                                     .mapResourcePolicies(rs);
                             return pol;
                         }
                     });
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error(
                     "Permission Denied: policy retrieval for '{}' for user '{}'",
                     target, user.getId());
@@ -328,8 +323,9 @@
         }
     }
 
+
     @Override
-    public List<SecurityPolicy>[] findPolicies(String path, final User user,
+    public List<SecurityPolicy>[] findPolicies (String path, final User user,
             Byte perm) {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("path", StringUtils.buildSQLRegex(path));
@@ -337,33 +333,29 @@
         param.addValue("perm", perm);
         param.addValue("en", new Timestamp(TimeUtils.getNow().getMillis()));
 
-        String sql_new = "select pv.*, pv.perm & :perm as allowed, " +
-                "rh.depth, (select max(depth) from resource_tree " +
-                "where child_id=rh.child_id) as max_depth from policy_view as pv "
-                +
-                "inner join resource_tree as rh on rh.parent_id=pv.id " +
-                "where rt.name_path regexp :path and " +
-                "pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
-                +
-                "(pv.group_id='self' or pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid)) and "
-                +
-                "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
-                +
-                "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id in (select g.group_id from group_users "
-                +
-                "as g where g.user_id=:userid) or pos.group_id='self') and res.child_id=rh.child_id group by child_id)";
+        String sql_new = "select pv.*, pv.perm & :perm as allowed, "
+                + "rh.depth, (select max(depth) from resource_tree "
+                + "where child_id=rh.child_id) as max_depth from policy_view as pv "
+                + "inner join resource_tree as rh on rh.parent_id=pv.id "
+                + "where rt.name_path regexp :path and "
+                + "pv.enable <= :en and (pv.expire > :en or pv.expire is NULL) and "
+                + "(pv.group_id='self' or pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid)) and "
+                + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
+                + "(select sum(distinct res.depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id where (pos.group_id in (select g.group_id from group_users "
+                + "as g where g.user_id=:userid) or pos.group_id='self') and res.child_id=rh.child_id group by child_id)";
 
         try {
             return this.jdbcTemplate.query(sql_new, param,
                     new ResultSetExtractor<List<SecurityPolicy>[]>() {
 
                         @Override
-                        public List<SecurityPolicy>[] extractData(ResultSet rs)
+                        public List<SecurityPolicy>[] extractData (ResultSet rs)
                                 throws SQLException, DataAccessException {
                             return SecurityRowMappers.mapResourcePolicies(rs);
                         }
                     });
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error(
                     "Permission Denied for retrieval for resource id '{}' for user '{}'",
                     path, user.getId());
@@ -371,8 +363,11 @@
         }
     }
 
+
     /**
-     * @param path  if set searches in path where the child element equals name. Also applicable for root resources!
+     * @param path
+     *            if set searches in path where the child element
+     *            equals name. Also applicable for root resources!
      * @param user
      * @param clazz
      * @return
@@ -380,7 +375,7 @@
     //todo: not working yet!
     // todo: does not concern itsself with location matching, ever!
     @Override
-    public List<KustvaktResource.Container> getDescending(String path,
+    public List<KustvaktResource.Container> getDescending (String path,
             final User user, Byte b,
             final Class<? extends KustvaktResource> clazz)
             throws KustvaktException {
@@ -393,57 +388,39 @@
         String sql;
         if (path != null && !path.isEmpty()) {
             sql = "select pv.*, pv.perm & :perm as allowed, rh.depth, rh.name_path, (select max(depth) from resource_tree \n"
-                    +
-                    "where child_id=rh.child_id) as max_depth from policy_view as pv "
-                    +
-                    "inner join resource_tree as rh on rh.child_id=pv.id " +
-                    "where pv.type=:type and (rh.name_path like :part) and ((pv.creator=:userid and pv.group_id='self') or "
-                    +
-                    "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and "
-                    +
-                    "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
-                    +
-                    "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id "
-                    +
-                    "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid) "
-                    +
-                    "and res.child_id=rh.child_id group by child_id))) " +
-                    "group by pv.pid, pv.id having count(distinct pv.group_id) = "
-                    +
-                    "((select count(co.group_id) from group_ref as co where co.policy_id=pv.pid) or "
-                    +
-                    "(select 1 from policy_view as cp2 where cp2.group_id='self' and cp2.id=pv.id)) "
-                    +
-                    "order by rh.depth asc, pv.id desc;";
-        }else {
+                    + "where child_id=rh.child_id) as max_depth from policy_view as pv "
+                    + "inner join resource_tree as rh on rh.child_id=pv.id "
+                    + "where pv.type=:type and (rh.name_path like :part) and ((pv.creator=:userid and pv.group_id='self') or "
+                    + "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and "
+                    + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
+                    + "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id "
+                    + "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid) "
+                    + "and res.child_id=rh.child_id group by child_id))) "
+                    + "group by pv.pid, pv.id having count(distinct pv.group_id) = "
+                    + "((select count(co.group_id) from group_ref as co where co.policy_id=pv.pid) or "
+                    + "(select 1 from policy_view as cp2 where cp2.group_id='self' and cp2.id=pv.id)) "
+                    + "order by rh.depth asc, pv.id desc;";
+        }
+        else {
             sql = "select pv.*, pv.perm & :perm as allowed, rh.depth, rh.name_path, (select max(depth) from resource_tree \n"
-                    +
-                    "where child_id=rh.child_id) as max_depth from policy_view as pv "
-                    +
-                    "inner join resource_tree as rh on rh.child_id=pv.id " +
-                    "where pv.type=:type and ((pv.creator=:userid and pv.group_id='self') or "
-                    +
-                    "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and "
-                    +
-                    "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
-                    +
-                    "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id "
-                    +
-                    "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid) "
-                    +
-                    "and res.child_id=rh.child_id group by child_id))) " +
-                    "group by pv.pid, pv.id having count(distinct pv.group_id) = "
-                    +
-                    "((select count(co.group_id) from group_ref as co where co.policy_id=pv.pid) or "
-                    +
-                    "(select 1 from policy_view as cp2 where cp2.group_id='self' and cp2.id=pv.id)) "
-                    +
-                    "order by rh.depth asc, pv.id desc;";
+                    + "where child_id=rh.child_id) as max_depth from policy_view as pv "
+                    + "inner join resource_tree as rh on rh.child_id=pv.id "
+                    + "where pv.type=:type and ((pv.creator=:userid and pv.group_id='self') or "
+                    + "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and "
+                    + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) = "
+                    + "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id "
+                    + "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid) "
+                    + "and res.child_id=rh.child_id group by child_id))) "
+                    + "group by pv.pid, pv.id having count(distinct pv.group_id) = "
+                    + "((select count(co.group_id) from group_ref as co where co.policy_id=pv.pid) or "
+                    + "(select 1 from policy_view as cp2 where cp2.group_id='self' and cp2.id=pv.id)) "
+                    + "order by rh.depth asc, pv.id desc;";
         }
         try {
             return this.jdbcTemplate.query(sql, param,
                     new SecurityRowMappers.HierarchicalResultExtractor());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error(
                     "Permission Denied for retrieval for path '{}' for user '{}'",
                     path, user.getId());
@@ -452,9 +429,10 @@
         }
     }
 
+
     @Override
-    public List<KustvaktResource.Container> getAscending(String name, User user,
-            Byte b, Class<? extends KustvaktResource> clazz)
+    public List<KustvaktResource.Container> getAscending (String name,
+            User user, Byte b, Class<? extends KustvaktResource> clazz)
             throws KustvaktException {
         final MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("userid", user.getId());
@@ -465,59 +443,41 @@
         String sql;
         if (name != null && !name.isEmpty()) {
             sql = "select pv.*, pv.perm & :perm as allowed, rh.depth, rh.name_path,\n"
-                    +
-                    "(select max(depth) from resource_tree \n" +
-                    "where child_id=rh.child_id) as max_depth from policy_view as pv\n"
-                    +
-                    "inner join resource_tree as rh on rh.child_id=pv.id\n" +
-                    "where pv.id in (select rt.parent_id from resource_tree as rt inner join resource_store rs on rs.id=rt.child_id\n"
-                    +
-                    "where rs.type=:type and rt.name_path like :part) and ((pv.creator=:userid and pv.group_id='self') or\n"
-                    +
-                    "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and\n"
-                    +
-                    "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) =\n"
-                    +
-                    "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id\n"
-                    +
-                    "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid)\n"
-                    +
-                    "and res.child_id=rh.child_id group by child_id)))\n" +
-                    "group by pv.pid, pv.id having count(distinct pv.group_id) = \n"
-                    +
-                    "case when pv.creator=:userid then 1 else (select count(distinct co.group_id) "
-                    +
-                    "from group_ref as co where co.policy_id=pv.pid) end order by rh.depth desc, pv.id desc;";
-        }else {
+                    + "(select max(depth) from resource_tree \n"
+                    + "where child_id=rh.child_id) as max_depth from policy_view as pv\n"
+                    + "inner join resource_tree as rh on rh.child_id=pv.id\n"
+                    + "where pv.id in (select rt.parent_id from resource_tree as rt inner join resource_store rs on rs.id=rt.child_id\n"
+                    + "where rs.type=:type and rt.name_path like :part) and ((pv.creator=:userid and pv.group_id='self') or\n"
+                    + "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and\n"
+                    + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) =\n"
+                    + "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.id\n"
+                    + "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid)\n"
+                    + "and res.child_id=rh.child_id group by child_id)))\n"
+                    + "group by pv.pid, pv.id having count(distinct pv.group_id) = \n"
+                    + "case when pv.creator=:userid then 1 else (select count(distinct co.group_id) "
+                    + "from group_ref as co where co.policy_id=pv.pid) end order by rh.depth desc, pv.id desc;";
+        }
+        else {
             sql = "select pv.*, pv.perm & :perm as allowed, rh.depth, rh.name_path,\n"
-                    +
-                    "(select max(depth) from resource_tree \n" +
-                    "where child_id=rh.child_id) as max_depth from policy_view as pv\n"
-                    +
-                    "inner join resource_tree as rh on rh.child_id=pv.id\n" +
-                    "where pv.id in (select rt.parent_id from resource_tree as rt inner join resource_store rs on rs.id=rt.child_id\n"
-                    +
-                    "where rs.type=:type) and ((pv.creator=:userid and pv.group_id='self') or\n"
-                    +
-                    "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and\n"
-                    +
-                    "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) =\n"
-                    +
-                    "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.target_id\n"
-                    +
-                    "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid)\n"
-                    +
-                    "and res.child_id=rh.child_id group by child_id)))\n" +
-                    "group by pv.pid, pv.id having count(distinct pv.group_id) = \n"
-                    +
-                    "case when pv.creator=:userid then 1 else (select count(distinct co.group_id) "
-                    +
-                    "from group_ref as co where co.policy_id=pv.pid) end order by rh.depth desc, pv.id desc;";
+                    + "(select max(depth) from resource_tree \n"
+                    + "where child_id=rh.child_id) as max_depth from policy_view as pv\n"
+                    + "inner join resource_tree as rh on rh.child_id=pv.id\n"
+                    + "where pv.id in (select rt.parent_id from resource_tree as rt inner join resource_store rs on rs.id=rt.child_id\n"
+                    + "where rs.type=:type) and ((pv.creator=:userid and pv.group_id='self') or\n"
+                    + "(pv.group_id in (select g.group_id from group_users as g where g.user_id=:userid) and\n"
+                    + "(select sum(distinct depth) from resource_tree where child_id=rh.child_id) =\n"
+                    + "(select sum(distinct depth) from policy_view as pos inner join resource_tree as res on res.parent_id=pos.target_id\n"
+                    + "where pos.group_id in (select g.group_id from group_users as g where g.user_id=:userid)\n"
+                    + "and res.child_id=rh.child_id group by child_id)))\n"
+                    + "group by pv.pid, pv.id having count(distinct pv.group_id) = \n"
+                    + "case when pv.creator=:userid then 1 else (select count(distinct co.group_id) "
+                    + "from group_ref as co where co.policy_id=pv.pid) end order by rh.depth desc, pv.id desc;";
         }
         try {
             return this.jdbcTemplate.query(sql, param,
                     new SecurityRowMappers.HierarchicalResultExtractor());
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error(
                     "Permission Denied for retrieval for path '{}' for user '{}'",
                     name, user.getId());
@@ -526,48 +486,55 @@
         }
     }
 
+
     // todo: return all resources or only leave nodes? --> currently only leaves are returned
     // todo: access to leave node also means that the path to the root for that permission is allowed,
     // todo: thus all upper resource access is as well allowed
 
     //todo: remove not used context?! --> who is allowed to do so?
     @Override
-    public int deletePolicy(SecurityPolicy policy, User user)
+    public int deletePolicy (SecurityPolicy policy, User user)
             throws KustvaktException {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("id", policy.getID());
 
         try {
-            this.jdbcTemplate
-                    .update("DELETE FROM group_ref WHERE policy_id=:id", param);
-            return this.jdbcTemplate
-                    .update("DELETE FROM policy_store WHERE id=:id", param);
-        }catch (DataAccessException e) {
-            jlog.error("Operation (DELETE) not possible for '{}' for user '{}'",
+            this.jdbcTemplate.update(
+                    "DELETE FROM group_ref WHERE policy_id=:id", param);
+            return this.jdbcTemplate.update(
+                    "DELETE FROM policy_store WHERE id=:id", param);
+        }
+        catch (DataAccessException e) {
+            jlog.error(
+                    "Operation (DELETE) not possible for '{}' for user '{}'",
                     policy.toString(), user.getId());
             throw new dbException(user.getId(), "policy_store, group_ref",
                     StatusCodes.DB_DELETE_FAILED, policy.toString());
         }
     }
 
+
     @Override
-    public int deleteResourcePolicies(String id, User user)
+    public int deleteResourcePolicies (String id, User user)
             throws KustvaktException {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("id", id);
         String sql = "DELETE FROM policy_store WHERE target_id in (SELECT id FROM resource_store WHERE persistent_id=:id);";
         try {
             return this.jdbcTemplate.update(sql, param);
-        }catch (DataAccessException e) {
-            jlog.error("Operation (DELETE) not possible for '{}' for user '{}'",
+        }
+        catch (DataAccessException e) {
+            jlog.error(
+                    "Operation (DELETE) not possible for '{}' for user '{}'",
                     id, user.getId());
             throw new dbException(user.getId(), "policy_store",
                     StatusCodes.DB_DELETE_FAILED, id);
         }
     }
 
+
     @Override
-    public int updatePolicy(SecurityPolicy policy, User user)
+    public int updatePolicy (SecurityPolicy policy, User user)
             throws KustvaktException {
         MapSqlParameterSource np = new MapSqlParameterSource();
         np.addValue("posix", policy.getPermissionByte());
@@ -576,21 +543,23 @@
         np.addValue("id", policy.getID());
 
         try {
-            int result = this.jdbcTemplate
-                    .update("UPDATE policy_store SET posix=:posix WHERE id=:id",
-                            np);
+            int result = this.jdbcTemplate.update(
+                    "UPDATE policy_store SET posix=:posix WHERE id=:id", np);
             this.mapConstraints(policy);
             return result;
-        }catch (DataAccessException e) {
-            jlog.error("Operation (UPDATE) not possible for '{}' for user '{}'",
+        }
+        catch (DataAccessException e) {
+            jlog.error(
+                    "Operation (UPDATE) not possible for '{}' for user '{}'",
                     policy.toString(), user.getId());
             throw new dbException(user.getId(), "policy_store",
                     StatusCodes.DB_UPDATE_FAILED, policy.toString());
         }
     }
 
+
     @Override
-    public int checkPolicy(SecurityPolicy policy, User user)
+    public int checkPolicy (SecurityPolicy policy, User user)
             throws KustvaktException {
         if (policy.getID() == -1)
             return 0;
@@ -601,17 +570,21 @@
 
         try {
             return this.jdbcTemplate.queryForObject(sql1, param, Integer.class);
-        }catch (DataAccessException e) {
-            jlog.error("Operation (SELECT) not possible for '{}' for user '{}'",
+        }
+        catch (DataAccessException e) {
+            jlog.error(
+                    "Operation (SELECT) not possible for '{}' for user '{}'",
                     policy.getTarget(), user.getId());
             throw new dbException(user.getId(), "policy_store",
                     StatusCodes.DB_GET_FAILED, policy.toString());
         }
     }
 
+
     /**
-     * checks if the user is a member of the specified group. Additional ownership can be tested via boolean flag
-     *
+     * checks if the user is a member of the specified group.
+     * Additional ownership can be tested via boolean flag
+     * 
      * @param user
      * @param group
      * @param owner
@@ -619,7 +592,7 @@
      * @throws KustvaktException
      */
     @Override
-    public int matchCondition(User user, String group, boolean owner)
+    public int matchCondition (User user, String group, boolean owner)
             throws KustvaktException {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("userid", user.getId());
@@ -628,27 +601,29 @@
         String sql;
         if (owner) {
             sql = "SELECT COUNT(*) FROM group_users AS gu INNER JOIN group_store AS gs "
-                    +
-                    "ON gs.name=gu.group_id WHERE gu.user_id=:userid " +
-                    "AND gs.name=:group AND gu.admin=:isadmin;";
-        }else {
+                    + "ON gs.name=gu.group_id WHERE gu.user_id=:userid "
+                    + "AND gs.name=:group AND gu.admin=:isadmin;";
+        }
+        else {
             sql = "SELECT COUNT(*) FROM group_users AS gu INNER JOIN group_store AS gs "
-                    +
-                    "ON gs.name=gu.group_id WHERE gu.user_id=:userid " +
-                    "AND gs.name=:group;";
+                    + "ON gs.name=gu.group_id WHERE gu.user_id=:userid "
+                    + "AND gs.name=:group;";
         }
 
         try {
             return this.jdbcTemplate.queryForObject(sql, param, Integer.class);
-        }catch (DataAccessException e) {
-            jlog.error("Operation (SELECT) not possible for '{}' for user '{}'",
+        }
+        catch (DataAccessException e) {
+            jlog.error(
+                    "Operation (SELECT) not possible for '{}' for user '{}'",
                     group, user.getId());
             throw new dbException(user.getId(), "policy_store",
                     StatusCodes.DB_GET_FAILED, group);
         }
     }
 
-    private void createCondition(PolicyCondition condition, User user)
+
+    private void createCondition (PolicyCondition condition, User user)
             throws KustvaktException {
         MapSqlParameterSource param = new MapSqlParameterSource();
         param.addValue("name", condition.getSpecifier());
@@ -658,10 +633,11 @@
         param.addValue("sy", condition.getFlags().get(Attributes.SYM_USE));
         param.addValue("ex", condition.getFlags().get(Attributes.LICENCE));
         try {
-            this.jdbcTemplate
-                    .update("INSERT INTO group_store (name, sym_use, export, commercial) "
+            this.jdbcTemplate.update(
+                    "INSERT INTO group_store (name, sym_use, export, commercial) "
                             + "VALUES (:name, :sy, :ex, :com);", param);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Operation (INSERT) not possible for '{}'",
                     condition.toString());
             throw new dbException(user.getId(), "group_store",
@@ -669,24 +645,24 @@
         }
     }
 
+
     //todo: check for unique constraint exception and exclude from throw!
     @Override
-    public int addToCondition(String username, PolicyCondition condition,
+    public int addToCondition (String username, PolicyCondition condition,
             boolean admin) throws KustvaktException {
-        final String insert =
-                "INSERT INTO group_users (user_id, group_id, admin) " +
-                        "VALUES ((SELECT id FROM korap_users " +
-                        "WHERE username=:username), :group, :status);";
+        final String insert = "INSERT INTO group_users (user_id, group_id, admin) "
+                + "VALUES ((SELECT id FROM korap_users "
+                + "WHERE username=:username), :group, :status);";
         try {
             MapSqlParameterSource param = new MapSqlParameterSource();
             param.addValue("group", condition.getSpecifier());
             param.addValue("username", username);
             param.addValue("status", BooleanUtils.getBoolean(admin));
             return this.jdbcTemplate.update(insert, param);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             //todo: test with mysql
-            if (!e.getMessage().toLowerCase()
-                    .contains("UNIQUE".toLowerCase())) {
+            if (!e.getMessage().toLowerCase().contains("UNIQUE".toLowerCase())) {
                 jlog.error(
                         "Operation (INSERT) not possible for '{}' for user '{}'",
                         condition.toString(), username);
@@ -697,18 +673,22 @@
         }
     }
 
+
     /**
      * @param usernames
      * @param condition
      * @param admin
      * @return
-     * @throws KustvaktException userID and group_id have a unique constraint,
-     *                           thus: if any of the supplied users is already a member of the group, the entire chain will be broken!
+     * @throws KustvaktException
+     *             userID and group_id have a unique constraint,
+     *             thus: if any of the supplied users is already a
+     *             member of the group, the entire chain will be
+     *             broken!
      */
     //todo definitely needs rework
     //todo: test the unique index constraints!
     @Override
-    public int[] addToCondition(List<String> usernames,
+    public int[] addToCondition (List<String> usernames,
             PolicyCondition condition, boolean admin) throws KustvaktException {
         MapSqlParameterSource[] sources = new MapSqlParameterSource[usernames
                 .size()];
@@ -719,10 +699,9 @@
         //                "AND group_id=:group;";
 
         //todo: use index to create uniqueness. how to batch?
-        final String insert =
-                "INSERT INTO group_users (user_id, group_id, admin) " +
-                        "VALUES ((SELECT id FROM korap_users " +
-                        "WHERE username=:username), :group, :status);";
+        final String insert = "INSERT INTO group_users (user_id, group_id, admin) "
+                + "VALUES ((SELECT id FROM korap_users "
+                + "WHERE username=:username), :group, :status);";
         try {
             for (int idx = 0; idx < usernames.size(); idx++) {
                 //todo: dont do that here
@@ -743,22 +722,25 @@
             // todo: only insert if user is not already a member of this group
             //fixme: problem - unique constraints throws exception. skip that user entry?!
             return this.jdbcTemplate.batchUpdate(insert, sources);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             if (!e.getCause().toString().contains("UNIQUE")) {
                 jlog.error(
                         "Operation (INSERT) not possible for '{}' for user '{}'",
                         condition.toString(), usernames, e);
                 throw new KustvaktException(
-                        "Operation (INSERT) not possible for '" + condition
-                                .toString() + "' for user '" + usernames + "'",
-                        e, StatusCodes.CONNECTION_ERROR);
+                        "Operation (INSERT) not possible for '"
+                                + condition.toString() + "' for user '"
+                                + usernames + "'", e,
+                        StatusCodes.CONNECTION_ERROR);
             }
             return null;
         }
     }
 
+
     @Override
-    public void removeFromCondition(List<String> usernames,
+    public void removeFromCondition (List<String> usernames,
             PolicyCondition condition) throws KustvaktException {
         MapSqlParameterSource[] sources = new MapSqlParameterSource[usernames
                 .size()];
@@ -770,21 +752,23 @@
             sources[idx++] = param;
         }
 
-        final String del =
-                "DELETE FROM group_users WHERE group_id=:group AND user_id=(SELECT id FROM "
-                        + "korap_users WHERE username=:username);";
+        final String del = "DELETE FROM group_users WHERE group_id=:group AND user_id=(SELECT id FROM "
+                + "korap_users WHERE username=:username);";
 
         try {
             this.jdbcTemplate.batchUpdate(del, sources);
-        }catch (DataAccessException e) {
-            jlog.error("Operation (DELETE) not possible for '{}' for user '{}'",
+        }
+        catch (DataAccessException e) {
+            jlog.error(
+                    "Operation (DELETE) not possible for '{}' for user '{}'",
                     condition.toString(), usernames);
             throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     @Override
-    public int createParamBinding(Parameter param) throws KustvaktException {
+    public int createParamBinding (Parameter param) throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("key", param.getName());
         source.addValue("policy", param.getPolicy().getID());
@@ -794,44 +778,46 @@
         //todo:
         //        if (!parameterExists(param.getName()))
         //            createParameter(param.getName(), "", param.getOwner());
-        final String insert =
-                "INSERT INTO param_map (param_id, policy_id, value, flag) VALUES ((SELECT id FROM param_store "
-                        + "WHERE p_key=:key), (SELECT id FROM policy_store WHERE id=:policy), :value, :flag);";
+        final String insert = "INSERT INTO param_map (param_id, policy_id, value, flag) VALUES ((SELECT id FROM param_store "
+                + "WHERE p_key=:key), (SELECT id FROM policy_store WHERE id=:policy), :value, :flag);";
         try {
             return this.jdbcTemplate.update(insert, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Operation (INSERT) not possible for '{}",
                     param.toString());
             throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     @Override
-    public List<String> getUsersFromCondition(PolicyCondition condition)
+    public List<String> getUsersFromCondition (PolicyCondition condition)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("specifier", condition.getSpecifier());
-        final String sql1 =
-                "SELECT username FROM korap_users WHERE id IN (SELECT user_id FROM "
-                        + "group_users WHERE group_id=:specifier);";
+        final String sql1 = "SELECT username FROM korap_users WHERE id IN (SELECT user_id FROM "
+                + "group_users WHERE group_id=:specifier);";
         try {
             return this.jdbcTemplate.queryForList(sql1, source, String.class);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             jlog.error("Operation (SELECT) not possible for '{}'",
                     condition.toString());
             throw new KustvaktException(StatusCodes.CONNECTION_ERROR);
         }
     }
 
-    private boolean parameterExists(String key) {
+
+    private boolean parameterExists (String key) {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("key", key);
         final String select = "SELECT COUNT(*) FROM param_store WHERE p_key=:key;";
-        return this.jdbcTemplate.queryForObject(select, source, Integer.class)
-                == 1;
+        return this.jdbcTemplate.queryForObject(select, source, Integer.class) == 1;
     }
 
-    private void createParameter(String parameter, String value, Integer owner)
+
+    private void createParameter (String parameter, String value, Integer owner)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("name", parameter);
@@ -840,32 +826,36 @@
         final String sql = "INSERT INTO param_store (p_key, p_value) VALUES (:name, :value);";
         try {
             this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     @Override
-    public int removeParamBinding(SecurityPolicy policy)
+    public int removeParamBinding (SecurityPolicy policy)
             throws KustvaktException {
         MapSqlParameterSource source = new MapSqlParameterSource();
         source.addValue("id", policy.getID());
         final String sql = "DELETE FROM param_map WHERE policy_id=:id";
         try {
             return this.jdbcTemplate.update(sql, source);
-        }catch (DataAccessException e) {
+        }
+        catch (DataAccessException e) {
             throw new KustvaktException(e, StatusCodes.CONNECTION_ERROR);
         }
     }
 
+
     @Override
-    public int size() {
+    public int size () {
         String sql = "SELECT COUNT(*) FROM policy_view;";
         try {
-            return this.jdbcTemplate
-                    .queryForObject(sql, new HashMap<String, Object>(),
-                            Integer.class);
-        }catch (DataAccessException e) {
+            return this.jdbcTemplate.queryForObject(sql,
+                    new HashMap<String, Object>(), Integer.class);
+        }
+        catch (DataAccessException e) {
             return 0;
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
index ed1d0af..9a70f81 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/PolicyEvaluator.java
@@ -33,14 +33,16 @@
     @Deprecated
     private Map<String, Object> flags;
 
-    public PolicyEvaluator(User user, List<SecurityPolicy>[] policies) {
+
+    public PolicyEvaluator (User user, List<SecurityPolicy>[] policies) {
         this.user = user;
         this.policies = policies;
         this.permissions = new PermissionsBuffer();
         this.flags = new HashMap<>();
     }
 
-    private PolicyEvaluator(User user, KustvaktResource resource) {
+
+    private PolicyEvaluator (User user, KustvaktResource resource) {
         this.user = user;
         this.resourceID = resource.getPersistentID();
         this.permissions = new PermissionsBuffer();
@@ -48,15 +50,17 @@
         this.policies = null;
     }
 
-    public String getResourceID() {
+
+    public String getResourceID () {
         if (this.resourceID == null && policies[0] != null
                 && policies[0].get(0) != null)
             this.resourceID = policies[0].get(0).getTarget();
         return this.resourceID;
     }
 
+
     // todo: test benchmarks
-    private List<SecurityPolicy> evaluate(List<SecurityPolicy>[] policies,
+    private List<SecurityPolicy> evaluate (List<SecurityPolicy>[] policies,
             Permissions.Permission perm) throws NotAuthorizedException {
         //fixme: what happens in case a parent relation does not allow changing a resource, but the owner of child per default
         //todo: receives all rights? --> test casing
@@ -70,16 +74,16 @@
                 int idx = 0;
                 if (policies[i] != null) {
                     int ow = getOwner(policies[i]);
-                    for (int internal = 0;
-                         internal < policies[i].size(); internal++) {
+                    for (int internal = 0; internal < policies[i].size(); internal++) {
                         SecurityPolicy s = policies[i].get(internal);
                         if (i == policies.length - 1) {
                             if (ow == user.getId())
                                 this.permissions.addPermission(127);
                             else if (!(s instanceof SecurityPolicy.OwnerPolicy))
-                                this.permissions
-                                        .addPermission(s.getPermissionByte());
-                        }else {
+                                this.permissions.addPermission(s
+                                        .getPermissionByte());
+                        }
+                        else {
                             if (ow == user.getId())
                                 this.permissions.retain(127);
                             else if (!(s instanceof SecurityPolicy.OwnerPolicy))
@@ -92,16 +96,16 @@
                 if (idx == 0) {
                     relationError = i;
                     throw new NotAuthorizedException(
-                            StatusCodes.PERMISSION_DENIED,
-                            this.getResourceID());
+                            StatusCodes.PERMISSION_DENIED, this.getResourceID());
                 }
             }
             this.processed = true;
             System.out.println("FINAL BYTE :" + this.permissions.getPbyte());
             if (this.permissions.containsPermission(perm))
                 return policies[0];
-        }else if (processed && relationError == -1 && this.permissions
-                .containsPermission(perm)) {
+        }
+        else if (processed && relationError == -1
+                && this.permissions.containsPermission(perm)) {
             jlog.debug("Done processing resource policies");
             jlog.debug("Will return policies to security manager: "
                     + this.policies[0]);
@@ -111,60 +115,69 @@
         return Collections.emptyList();
     }
 
+
     /**
      * checks read permission
-     *
+     * 
      * @return
      */
-    public boolean isAllowed() {
+    public boolean isAllowed () {
         return isAllowed(Permissions.Permission.READ);
     }
 
-    public boolean isAllowed(Permissions.Permission perm) {
+
+    public boolean isAllowed (Permissions.Permission perm) {
         try {
             List s = evaluate(this.policies, perm);
             return s != null && !s.isEmpty();
-        }catch (NotAuthorizedException e) {
+        }
+        catch (NotAuthorizedException e) {
             return false;
         }
     }
 
-    public boolean isOwner() {
+
+    public boolean isOwner () {
         return policies != null && this.user.getId() != null
                 && getOwner(this.policies[0]) == this.user.getId();
     }
 
-    private int getOwner(List<SecurityPolicy> policies) {
-        if (policies != null && policies.get(0) != null && policies
-                .get(0) instanceof SecurityPolicy.OwnerPolicy) {
+
+    private int getOwner (List<SecurityPolicy> policies) {
+        if (policies != null && policies.get(0) != null
+                && policies.get(0) instanceof SecurityPolicy.OwnerPolicy) {
             return ((SecurityPolicy.OwnerPolicy) policies.get(0)).getOwner();
         }
         return -1;
     }
 
+
     // todo: what is this supposed to do?
     @Deprecated
-    public static PolicyEvaluator setFlags(User user,
-            KustvaktResource resource) {
+    public static PolicyEvaluator setFlags (User user, KustvaktResource resource) {
         PolicyEvaluator e = new PolicyEvaluator(user, resource);
-//        e.setFlag("managed", resource.getOwner() == KorAPUser.ADMINISTRATOR_ID);
-//        e.setFlag("shared", false);
+        //        e.setFlag("managed", resource.getOwner() == KorAPUser.ADMINISTRATOR_ID);
+        //        e.setFlag("shared", false);
         return e;
     }
 
-    public <V> V getFlag(String key, V value) {
+
+    public <V> V getFlag (String key, V value) {
         return (V) this.flags.get(key);
     }
 
-    private <V> void setFlag(String key, V value) {
+
+    private <V> void setFlag (String key, V value) {
         this.flags.put(key, value);
     }
 
-    public boolean isManaged() {
+
+    public boolean isManaged () {
         return getOwner(this.policies[0]) == KorAPUser.ADMINISTRATOR_ID;
     }
 
-    public boolean isShared() {
+
+    public boolean isShared () {
         return !isManaged() && !isOwner();
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
index 232c5eb..4dffda5 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceFinder.java
@@ -33,17 +33,20 @@
     private List<KustvaktResource.Container> containers;
     private User user;
 
-    private ResourceFinder(User user) {
+
+    private ResourceFinder (User user) {
         this();
         this.user = user;
     }
 
-    private ResourceFinder() {
+
+    private ResourceFinder () {
         this.containers = new ArrayList<>();
         overrideProviders(null);
     }
 
-    public static void overrideProviders(ContextHolder beans) {
+
+    public static void overrideProviders (ContextHolder beans) {
         if (beans == null)
             beans = BeansFactory.getKustvaktContext();
         if (policydao == null | resourcedaos == null) {
@@ -55,16 +58,18 @@
             throw new RuntimeException("provider not set!");
     }
 
-    public static <T extends KustvaktResource> Set<T> search(String path,
+
+    public static <T extends KustvaktResource> Set<T> search (String path,
             boolean asParent, User user, Class<T> clazz,
-            Permissions.Permission... perms) throws KustvaktException {
+            Permissions.Permission ... perms) throws KustvaktException {
         ResourceFinder cat = init(path, asParent, user, clazz, perms);
         return cat.getResources();
     }
 
-    private static <T extends KustvaktResource> ResourceFinder init(String path,
-            boolean asParent, User user, Class<T> clazz,
-            Permissions.Permission... perms) throws KustvaktException {
+
+    private static <T extends KustvaktResource> ResourceFinder init (
+            String path, boolean asParent, User user, Class<T> clazz,
+            Permissions.Permission ... perms) throws KustvaktException {
         ResourceFinder cat = new ResourceFinder(user);
         PermissionsBuffer buffer = new PermissionsBuffer();
         if (perms.length == 0)
@@ -74,50 +79,55 @@
         return cat;
     }
 
+
     //todo: needs to be much faster!
-    public static <T extends KustvaktResource> ResourceFinder init(
+    public static <T extends KustvaktResource> ResourceFinder init (
             @NonNull User user, Class<T> clazz) throws KustvaktException {
         return init(null, true, user, clazz, Permissions.Permission.READ);
     }
 
-    public static <T extends KustvaktResource> Set<T> search(String name,
+
+    public static <T extends KustvaktResource> Set<T> search (String name,
             boolean asParent, User user, String type) throws KustvaktException {
         return (Set<T>) search(name, asParent, user,
                 ResourceFactory.getResourceClass(type),
                 Permissions.Permission.READ);
     }
 
-    public static <T extends KustvaktResource> Set<T> searchPublic(
+
+    public static <T extends KustvaktResource> Set<T> searchPublic (
             Class<T> clazz) throws KustvaktException {
         return searchPublicFiltered(clazz);
     }
 
-    public static <T extends KustvaktResource> Set<T> searchPublicFiltered(
-            Class<T> clazz, String ...ids) throws KustvaktException {
+
+    public static <T extends KustvaktResource> Set<T> searchPublicFiltered (
+            Class<T> clazz, String ... ids) throws KustvaktException {
         overrideProviders(null);
         Set<T> sets = new HashSet<>();
-        List<SecurityPolicy> policies = policydao
-                .getPolicies(new PolicyCondition(Attributes.PUBLIC_GROUP),
-                        clazz, Permissions.Permission.READ.toByte());
+        List<SecurityPolicy> policies = policydao.getPolicies(
+                new PolicyCondition(Attributes.PUBLIC_GROUP), clazz,
+                Permissions.Permission.READ.toByte());
 
         List<String> id_set = Arrays.asList(ids);
         for (SecurityPolicy policy : policies) {
-            T r = (T) resourcedaos.get(KustvaktResource.class)
-                    .findbyId(policy.getTarget(),
-                            User.UserFactory.getDemoUser());
+            T r = (T) resourcedaos.get(KustvaktResource.class).findbyId(
+                    policy.getTarget(), User.UserFactory.getDemoUser());
             if (id_set.isEmpty() || id_set.contains(r.getPersistentID()))
                 sets.add(r);
         }
         return sets;
     }
 
+
     // todo: should this be working?
-    public static <T extends KustvaktResource> Set<T> search(User user,
+    public static <T extends KustvaktResource> Set<T> search (User user,
             Class<T> clazz) throws KustvaktException {
         return search(null, true, user, clazz, Permissions.Permission.READ);
     }
 
-    private void retrievePolicies(String path, Byte b, Class type,
+
+    private void retrievePolicies (String path, Byte b, Class type,
             boolean parent) throws KustvaktException {
         //fixme: throw exception to avoid susequent exceptions due to unknown origin
         if (user == null | type == null)
@@ -128,12 +138,14 @@
             this.containers = policydao.getAscending(path, user, b, type);
     }
 
-    public <T extends KustvaktResource> Set<T> getResources() {
+
+    public <T extends KustvaktResource> Set<T> getResources () {
         return evaluateResources();
     }
 
+
     // todo: redo with less memory usage/faster
-    private <T extends KustvaktResource> Set<T> evaluateResources() {
+    private <T extends KustvaktResource> Set<T> evaluateResources () {
         Set<T> resources = new HashSet<>();
         if (this.containers != null) {
             for (KustvaktResource.Container c : this.containers) {
@@ -141,12 +153,13 @@
                     T resource = (T) resourcedaos.get(KustvaktResource.class)
                             .findbyId(c.getPersistentID(), this.user);
                     if (resource != null) {
-                        PolicyEvaluator e = PolicyEvaluator
-                                .setFlags(user, resource);
+                        PolicyEvaluator e = PolicyEvaluator.setFlags(user,
+                                resource);
                         //                        resource.setManaged(e.getFlag("managed", false));
                         resources.add(resource);
                     }
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     // don't handle connection error or no handler registered!
                     jlog.error("Error while retrieving containers '{}' ",
                             this.containers);
@@ -157,7 +170,8 @@
         return resources;
     }
 
-    public Set<String> getIds() {
+
+    public Set<String> getIds () {
         Set<String> resources = new HashSet<>();
         for (KustvaktResource.Container c : this.containers)
             resources.add(c.getPersistentID());
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java
index 840461b..7d34efa 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/ResourceHandler.java
@@ -27,132 +27,154 @@
 
     private static Logger jlog = LoggerFactory.getLogger(ResourceHandler.class);
 
-    public ResourceHandler() {
-    }
 
-    public <T extends KustvaktResource> T getCache(Object id, Class<T> clazz) {
-        Element e = CacheManager.getInstance().getCache("resources")
-                .get(id);
+    public ResourceHandler () {}
+
+
+    public <T extends KustvaktResource> T getCache (Object id, Class<T> clazz) {
+        Element e = CacheManager.getInstance().getCache("resources").get(id);
         if (e != null)
             return (T) e.getObjectValue();
         else
             return null;
     }
 
-    public <R extends KustvaktResource> void cache(R resource) {
+
+    public <R extends KustvaktResource> void cache (R resource) {
         CacheManager.getInstance().getCache("resources")
                 .put(new Element(resource.getPersistentID(), resource));
     }
 
+
     /**
      * @param id
      * @param user
      * @return
-     * @throws KustvaktException         if there is no handler registered, resource might still be valid,
-     *                                only Notauthorized exception will cause a parsing error here
+     * @throws KustvaktException
+     *             if there is no handler registered, resource might
+     *             still be valid,
+     *             only Notauthorized exception will cause a parsing
+     *             error here
      * @throws NotAuthorizedException
      */
-    public <T extends KustvaktResource> T findbyIntId(Integer id, User user)
+    public <T extends KustvaktResource> T findbyIntId (Integer id, User user)
             throws KustvaktException, NotAuthorizedException {
         SecurityManager<T> p;
         try {
             p = SecurityManager.findbyId(id, user);
-        } catch (EmptyResultException e) {
-            throw new NotAuthorizedException(StatusCodes.EMPTY_RESULTS, String.valueOf(id));
+        }
+        catch (EmptyResultException e) {
+            throw new NotAuthorizedException(StatusCodes.EMPTY_RESULTS,
+                    String.valueOf(id));
         }
         return p.getResource();
     }
 
-    public <T extends KustvaktResource> T findbyStrId(String persistent_id,
-            User user, String type)
-            throws KustvaktException, NotAuthorizedException {
+
+    public <T extends KustvaktResource> T findbyStrId (String persistent_id,
+            User user, String type) throws KustvaktException,
+            NotAuthorizedException {
         return (T) findbyStrId(persistent_id, user,
                 ResourceFactory.getResourceClass(type));
     }
 
-    public <T extends KustvaktResource> T findbyStrId(String persistent_id,
-            User user, Class<T> type)
-            throws KustvaktException, NotAuthorizedException {
+
+    public <T extends KustvaktResource> T findbyStrId (String persistent_id,
+            User user, Class<T> type) throws KustvaktException,
+            NotAuthorizedException {
         //T cache = (T) getCache(persistent_id, type);
         //if (cache != null)
         //    return cache;
         //else {
-            SecurityManager<T> p;
-            try {
-                p = SecurityManager.findbyId(persistent_id, user, type);
-            } catch (EmptyResultException e) {
-                throw new NotAuthorizedException(StatusCodes.EMPTY_RESULTS, persistent_id);
-            }
-            return p.getResource();
+        SecurityManager<T> p;
+        try {
+            p = SecurityManager.findbyId(persistent_id, user, type);
+        }
+        catch (EmptyResultException e) {
+            throw new NotAuthorizedException(StatusCodes.EMPTY_RESULTS,
+                    persistent_id);
+        }
+        return p.getResource();
         //}
     }
 
-    public <T extends KustvaktResource> Collection<T> findbyPath(String path, Class type, User user)
-            throws KustvaktException, NotAuthorizedException {
+
+    public <T extends KustvaktResource> Collection<T> findbyPath (String path,
+            Class type, User user) throws KustvaktException,
+            NotAuthorizedException {
         return ResourceFinder.search(path, false, user, type);
     }
 
 
-    public <T extends KustvaktResource> void updateResources(User user, T... resources)
-            throws KustvaktException, NotAuthorizedException {
+    public <T extends KustvaktResource> void updateResources (User user,
+            T ... resources) throws KustvaktException, NotAuthorizedException {
         // fixme: what if update fails? then i have a root policy lingering for a resource that is not available?!
         // fixme: transaction management
 
         for (T resource : resources) {
             SecurityManager policies;
             try {
-                policies = SecurityManager.init(resource.getPersistentID(), user, Permissions.Permission.WRITE);
-            } catch (EmptyResultException e) {
+                policies = SecurityManager.init(resource.getPersistentID(),
+                        user, Permissions.Permission.WRITE);
+            }
+            catch (EmptyResultException e) {
                 return;
             }
             policies.updateResource(resource);
         }
     }
 
-    public <T extends KustvaktResource> void storeResources(User user, T... resources)
-            throws KustvaktException, NotAuthorizedException {
+
+    public <T extends KustvaktResource> void storeResources (User user,
+            T ... resources) throws KustvaktException, NotAuthorizedException {
         for (T resource : resources)
             SecurityManager.register(resource, user);
     }
 
+
     @Deprecated
-    public <T extends KustvaktResource> void deleteResources(User user, String... ids)
-            throws KustvaktException, NotAuthorizedException {
+    public <T extends KustvaktResource> void deleteResources (User user,
+            String ... ids) throws KustvaktException, NotAuthorizedException {
         for (String id : ids) {
             SecurityManager policies;
             try {
                 policies = SecurityManager.init(id, user,
                         Permissions.Permission.DELETE);
-            } catch (EmptyResultException e) {
+            }
+            catch (EmptyResultException e) {
                 return;
             }
             policies.deleteResource();
         }
     }
 
-    public <T extends KustvaktResource> void deleteResources(User user, T... resources)
-            throws KustvaktException, NotAuthorizedException {
+
+    public <T extends KustvaktResource> void deleteResources (User user,
+            T ... resources) throws KustvaktException, NotAuthorizedException {
         for (T r : resources) {
             SecurityManager manager;
             try {
-                manager = SecurityManager.findbyId(r.getPersistentID(), user, r.getClass(),
-                        Permissions.Permission.DELETE);
-            } catch (EmptyResultException e) {
+                manager = SecurityManager.findbyId(r.getPersistentID(), user,
+                        r.getClass(), Permissions.Permission.DELETE);
+            }
+            catch (EmptyResultException e) {
                 return;
             }
             manager.deleteResource();
         }
     }
 
+
     @Deprecated
-    public <T extends KustvaktResource> void deleteResources(User user, Integer... ids)
-            throws KustvaktException, NotAuthorizedException {
+    public <T extends KustvaktResource> void deleteResources (User user,
+            Integer ... ids) throws KustvaktException, NotAuthorizedException {
         for (Integer id : ids) {
             SecurityManager policies;
             try {
                 policies = SecurityManager.findbyId(id, user,
                         Permissions.Permission.DELETE);
-            } catch (EmptyResultException e) {
+            }
+            catch (EmptyResultException e) {
                 return;
             }
             policies.deleteResource();
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
index b66fe62..0bf367c 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityManager.java
@@ -23,9 +23,11 @@
 import java.util.*;
 
 /**
- * should only be used if a resource is uniquely identifiable by either three methods: id, name or path!
- * In any other case, use categorypolicies to retrieve policies of a certain type
- *
+ * should only be used if a resource is uniquely identifiable by
+ * either three methods: id, name or path!
+ * In any other case, use categorypolicies to retrieve policies of a
+ * certain type
+ * 
  * @author hanl
  * @date 15/01/2014
  */
@@ -49,8 +51,9 @@
     private PolicyEvaluator evaluator;
     private T resource;
 
+
     //todo: use simple user id if possible! --> or if not check that user has valid integer id (or use username as fallback instead)
-    private SecurityManager(User user) {
+    private SecurityManager (User user) {
         this.policies = new List[1];
         this.policies[0] = new ArrayList<>();
         this.silent = true;
@@ -58,7 +61,8 @@
         overrideProviders(null);
     }
 
-    public static void overrideProviders(ContextHolder beans) {
+
+    public static void overrideProviders (ContextHolder beans) {
         if (beans == null)
             beans = BeansFactory.getKustvaktContext();
         if (policydao == null | crypto == null) {
@@ -74,8 +78,9 @@
             throw new RuntimeException("providers not set!");
     }
 
+
     @Deprecated
-    public static final void setProviders(PolicyHandlerIface policyHandler,
+    public static final void setProviders (PolicyHandlerIface policyHandler,
             EncryptionIface crypto, Collection<ResourceOperationIface> ifaces) {
         SecurityManager.policydao = policyHandler;
         SecurityManager.crypto = crypto;
@@ -85,10 +90,13 @@
         //            handlers.put(iface.getType(), iface);
     }
 
+
     /**
-     * only allowed if the resource is uniquely identifiable by the name, if not, use path or id!
-     * Shortcut so resource values do not need to be retrieved afterwards!
-     *
+     * only allowed if the resource is uniquely identifiable by the
+     * name, if not, use path or id!
+     * Shortcut so resource values do not need to be retrieved
+     * afterwards!
+     * 
      * @param name
      * @param user
      * @param type
@@ -97,74 +105,83 @@
      * @throws KustvaktException
      */
     //todo: implement a fall back that throws an exception when the user NULL, but the resource has restrictions!
-    public static SecurityManager findbyId(String id, User user, Class type,
-            Permissions.Permission... perms) throws KustvaktException {
+    public static SecurityManager findbyId (String id, User user, Class type,
+            Permissions.Permission ... perms) throws KustvaktException {
         SecurityManager p = new SecurityManager(user);
         p.findPolicies(id, false, perms);
         p.resource = p.findResource(type);
         return p;
     }
 
-    public static SecurityManager findbyId(String id, User user,
-            Permissions.Permission... perms) throws KustvaktException {
+
+    public static SecurityManager findbyId (String id, User user,
+            Permissions.Permission ... perms) throws KustvaktException {
         SecurityManager p = new SecurityManager(user);
         p.findPolicies(id, false, perms);
         p.resource = p.findResource(null);
         return p;
     }
 
-    public static SecurityManager findbyId(Integer id, User user,
-            Permissions.Permission... perms) throws KustvaktException {
+
+    public static SecurityManager findbyId (Integer id, User user,
+            Permissions.Permission ... perms) throws KustvaktException {
         SecurityManager p = new SecurityManager(user);
         p.findPolicies(id, false, perms);
         p.resource = p.findResource(null);
         return p;
     }
 
-    public static SecurityManager findbyPath(String path, User user,
-            Permissions.Permission... perms)
-            throws NotAuthorizedException, EmptyResultException {
+
+    public static SecurityManager findbyPath (String path, User user,
+            Permissions.Permission ... perms) throws NotAuthorizedException,
+            EmptyResultException {
         SecurityManager manager = new SecurityManager(user);
         manager.findPolicies(path, true, perms);
         //fixme: need a match count. if match not unique, exception. also, does parent -child relation match hold up here?
         return manager;
     }
 
-    public static SecurityManager init(String id, User user,
-            Permissions.Permission... perms)
-            throws NotAuthorizedException, EmptyResultException {
+
+    public static SecurityManager init (String id, User user,
+            Permissions.Permission ... perms) throws NotAuthorizedException,
+            EmptyResultException {
         SecurityManager p = new SecurityManager(user);
         p.findPolicies(id, false, perms);
         return p;
     }
 
+
     /**
      * enables retrieval for read access only!
-     *
+     * 
      * @return
      * @throws NotAuthorizedException
      */
-    public final T getResource() throws NotAuthorizedException {
+    public final T getResource () throws NotAuthorizedException {
         if (evaluator.isAllowed(Permissions.Permission.READ)) {
             return this.resource;
-        }else {
-            jlog.error("Reading the resource '{}' is not allowed for user '{}'",
+        }
+        else {
+            jlog.error(
+                    "Reading the resource '{}' is not allowed for user '{}'",
                     this.resource.getPersistentID(), this.user.getUsername());
             throw new NotAuthorizedException(StatusCodes.PERMISSION_DENIED,
                     evaluator.getResourceID());
         }
     }
 
-    public void updateResource(T resource)
-            throws NotAuthorizedException, KustvaktException {
+
+    public void updateResource (T resource) throws NotAuthorizedException,
+            KustvaktException {
         if (evaluator.isAllowed(Permissions.Permission.WRITE)) {
             ResourceOperationIface iface = handlers.get(resource.getClass());
             if (iface != null)
                 iface.updateResource(resource, this.user);
             else
-                handlers.get(KustvaktResource.class)
-                        .updateResource(resource, this.user);
-        }else {
+                handlers.get(KustvaktResource.class).updateResource(resource,
+                        this.user);
+        }
+        else {
             jlog.error(
                     "Updating the resource '{}' is not allowed for user '{}'",
                     this.resource.getPersistentID(), this.user.getUsername());
@@ -174,47 +191,48 @@
 
     }
 
+
     /**
      * @throws NotAuthorizedException
      * @throws KustvaktException
      */
     // todo: delete only works with find, not with init constructor!
-    public void deleteResource()
-            throws NotAuthorizedException, KustvaktException {
+    public void deleteResource () throws NotAuthorizedException,
+            KustvaktException {
         if (evaluator.isAllowed(Permissions.Permission.DELETE)) {
-            ResourceOperationIface iface = handlers
-                    .get(this.resource.getClass());
+            ResourceOperationIface iface = handlers.get(this.resource
+                    .getClass());
             if (iface != null)
                 iface.deleteResource(this.evaluator.getResourceID(), this.user);
             else
-                handlers.get(KustvaktResource.class)
-                        .deleteResource(this.evaluator.getResourceID(),
-                                this.user);
-            this.policydao
-                    .deleteResourcePolicies(this.evaluator.getResourceID(),
-                            this.user);
-        }else
+                handlers.get(KustvaktResource.class).deleteResource(
+                        this.evaluator.getResourceID(), this.user);
+            this.policydao.deleteResourcePolicies(
+                    this.evaluator.getResourceID(), this.user);
+        }
+        else
             throw new NotAuthorizedException(StatusCodes.PERMISSION_DENIED,
                     this.evaluator.getResourceID());
     }
 
+
     // todo: type should be deprecated and return type of policies should be containers!
-    private boolean findPolicies(Object id, boolean path,
-            Permissions.Permission... perms) throws EmptyResultException {
+    private boolean findPolicies (Object id, boolean path,
+            Permissions.Permission ... perms) throws EmptyResultException {
         PermissionsBuffer b = new PermissionsBuffer();
         if (perms.length == 0)
             b.addPermission(Permissions.Permission.READ.toByte());
         else
             b.addPermissions(perms);
         if (id instanceof String && !path)
-            this.policies = policydao
-                    .getPolicies((String) id, this.user, b.getPbyte());
+            this.policies = policydao.getPolicies((String) id, this.user,
+                    b.getPbyte());
         if (id instanceof String && path)
-            this.policies = policydao
-                    .findPolicies((String) id, this.user, b.getPbyte());
+            this.policies = policydao.findPolicies((String) id, this.user,
+                    b.getPbyte());
         if (id instanceof Integer)
-            this.policies = policydao
-                    .getPolicies((Integer) id, this.user, b.getPbyte());
+            this.policies = policydao.getPolicies((Integer) id, this.user,
+                    b.getPbyte());
         this.evaluator = new PolicyEvaluator(this.user, this.policies);
 
         if (this.policies == null) {
@@ -225,9 +243,10 @@
         return true;
     }
 
+
     // todo:  security log shows id 'null' --> better way?
-    private T findResource(Class type)
-            throws NotAuthorizedException, KustvaktException {
+    private T findResource (Class type) throws NotAuthorizedException,
+            KustvaktException {
         if (!evaluator.isAllowed()) {
             jlog.error("Permission denied for resource id '{}' for user '{}'",
                     this.evaluator.getResourceID(), user.getId());
@@ -238,8 +257,8 @@
         ResourceOperationIface iface = handlers.get(type);
         if (iface == null)
             iface = handlers.get(KustvaktResource.class);
-        T resource = (T) iface
-                .findbyId(this.evaluator.getResourceID(), this.user);
+        T resource = (T) iface.findbyId(this.evaluator.getResourceID(),
+                this.user);
         // fixme: this
         // fixme: deprecated!
         resource.setManaged(this.evaluator.isManaged());
@@ -247,13 +266,15 @@
         return resource;
     }
 
-    private boolean checkResource(String persistentID, User user)
+
+    private boolean checkResource (String persistentID, User user)
             throws KustvaktException {
         ResourceOperationIface iface = handlers.get(KustvaktResource.class);
         return iface.findbyId(persistentID, user) != null;
     }
 
-    public static SecurityManager register(KustvaktResource resource, User user)
+
+    public static SecurityManager register (KustvaktResource resource, User user)
             throws KustvaktException, NotAuthorizedException {
         SecurityManager p = new SecurityManager(user);
         if (!User.UserFactory.isDemo(user.getUsername())) {
@@ -264,7 +285,8 @@
                     // --> in order not to have a resource owner that is denied access due to missing parent relation dependency
                     SecurityManager.findbyId(resource.getParentID(), user,
                             Permissions.Permission.ALL);
-                }catch (EmptyResultException e) {
+                }
+                catch (EmptyResultException e) {
                     jlog.error(
                             "No policies found for parent '{}' for user '{}'",
                             resource.getParentID(), user.getId());
@@ -273,8 +295,8 @@
             }
             boolean newid = false;
             // create persistent identifier for the resource
-            if (resource.getPersistentID() == null || resource.getPersistentID()
-                    .isEmpty()) {
+            if (resource.getPersistentID() == null
+                    || resource.getPersistentID().isEmpty()) {
                 ResourceFactory.createID(resource);
                 newid = true;
             }
@@ -286,8 +308,8 @@
                         + resource.getPersistentID() + "@" + resource.getId()
                         + "', name: " + resource.getName());
                 // storing resource is called twice. first when this is register and later in idsbootstrap to create cstorage entry. how to unify this?
-                ResourceOperationIface iface = p.handlers
-                        .get(resource.getClass());
+                ResourceOperationIface iface = p.handlers.get(resource
+                        .getClass());
                 if (iface != null)
                     resource.setId(iface.storeResource(resource, user));
                 else
@@ -302,36 +324,39 @@
                         Permissions.Permission.CREATE_POLICY,
                         Permissions.Permission.READ_POLICY,
                         Permissions.Permission.MODIFY_POLICY);
-            }catch (EmptyResultException e) {
+            }
+            catch (EmptyResultException e) {
                 jlog.error(
                         "No policies found for '{}' for user '{}'. Resource could not be registered!",
                         resource.getPersistentID(), user.getId());
                 throw new KustvaktException(user.getId(),
                         StatusCodes.POLICY_CREATE_ERROR,
-                        "Resource could not be registered",
-                        resource.toString());
+                        "Resource could not be registered", resource.toString());
             }
         }
         return p;
     }
 
+
     @Deprecated
-    public List<SecurityPolicy> getPoliciesList(int i) {
+    public List<SecurityPolicy> getPoliciesList (int i) {
         if (i < this.policies.length)
             return this.policies[i];
         return Collections.emptyList();
     }
 
+
     // fixme: make protected
-    public SecurityPolicy getPolicy(Integer id) {
+    public SecurityPolicy getPolicy (Integer id) {
         for (SecurityPolicy p : this.policies[0])
             if (p.getID() == id)
                 return p;
         return null;
     }
 
+
     // fixme: make protected
-    public PolicyCondition getExtensional(Permissions.Permission... pps) {
+    public PolicyCondition getExtensional (Permissions.Permission ... pps) {
         for (SecurityPolicy p : this.policies[0]) {
             if (p.equalsPermission(pps)) {
                 for (PolicyCondition c : p.getConditions()) {
@@ -343,12 +368,14 @@
         return null;
     }
 
-    private boolean matchTarget(String target) {
-        return this.resource.getPersistentID() != null && (
-                this.resource.getPersistentID() == target);
+
+    private boolean matchTarget (String target) {
+        return this.resource.getPersistentID() != null
+                && (this.resource.getPersistentID() == target);
     }
 
-    public void addPolicy(SecurityPolicy policy, Parameter... params)
+
+    public void addPolicy (SecurityPolicy policy, Parameter ... params)
             throws KustvaktException, NotAuthorizedException {
         if (policy.getConditions().isEmpty()) {
             jlog.error("No conditions set for '{}' for user '{}'",
@@ -371,7 +398,8 @@
 
         if (evaluator.isAllowed(Permissions.Permission.CREATE_POLICY)) {
             policydao.createPolicy(policy, this.user);
-        }else if (silent) {
+        }
+        else if (silent) {
             jlog.error(
                     "Permission Denied (CREATE_POLICY) on '{}' for user '{}'",
                     this.evaluator.getResourceID(), this.user.getId());
@@ -388,18 +416,21 @@
         this.policies[0].add(policy);
         try {
             Thread.sleep(5);
-        }catch (InterruptedException e) {
+        }
+        catch (InterruptedException e) {
             e.printStackTrace();
         }
     }
 
-    public void deletePolicies()
-            throws NotAuthorizedException, KustvaktException {
+
+    public void deletePolicies () throws NotAuthorizedException,
+            KustvaktException {
         for (SecurityPolicy p : new ArrayList<>(this.policies[0]))
             deletePolicy(p);
     }
 
-    public void retainPolicies(List<SecurityPolicy> policies)
+
+    public void retainPolicies (List<SecurityPolicy> policies)
             throws NotAuthorizedException, KustvaktException {
         for (SecurityPolicy p : new ArrayList<>(this.policies[0])) {
             if (!policies.contains(p))
@@ -407,9 +438,10 @@
         }
     }
 
+
     // todo:
-    public void deletePolicy(SecurityPolicy policy)
-            throws KustvaktException, NotAuthorizedException {
+    public void deletePolicy (SecurityPolicy policy) throws KustvaktException,
+            NotAuthorizedException {
         // todo: get rid of this: use sql to match policy id and target according to evaluator!
         if (!matchTarget(policy.getTarget()))
             // adjust message
@@ -423,10 +455,11 @@
                     "no policy desicion possible",
                     this.evaluator.getResourceID());
         }
-        if (contains(policy) && (evaluator
-                .isAllowed(Permissions.Permission.DELETE_POLICY))) {
+        if (contains(policy)
+                && (evaluator.isAllowed(Permissions.Permission.DELETE_POLICY))) {
             policydao.deletePolicy(policy, this.user);
-        }else if (silent) {
+        }
+        else if (silent) {
             jlog.error("Permission Denied (DELETE_POLICY) on '{}' for '{}'",
                     this.evaluator.getResourceID(), this.user.getId());
             throw new NotAuthorizedException(StatusCodes.PERMISSION_DENIED,
@@ -438,8 +471,9 @@
         this.policies[0].remove(policy);
     }
 
-    public void modifyPolicy(SecurityPolicy policy)
-            throws KustvaktException, NotAuthorizedException {
+
+    public void modifyPolicy (SecurityPolicy policy) throws KustvaktException,
+            NotAuthorizedException {
         if (!matchTarget(policy.getTarget()))
             throw new NotAuthorizedException(StatusCodes.ILLEGAL_ARGUMENT);
 
@@ -452,43 +486,48 @@
                     this.evaluator.getResourceID());
         }
 
-        if (contains(policy) && (evaluator
-                .isAllowed(Permissions.Permission.MODIFY_POLICY))) {
+        if (contains(policy)
+                && (evaluator.isAllowed(Permissions.Permission.MODIFY_POLICY))) {
             policydao.updatePolicy(policy, this.user);
-        }else if (silent) {
+        }
+        else if (silent) {
             jlog.error("Permission Denied (DELETE_POLICY) on '{}' for '{}'",
                     this.evaluator.getResourceID(), this.user.getId());
             throw new NotAuthorizedException(StatusCodes.PERMISSION_DENIED,
                     this.evaluator.getResourceID());
         }
-        this.policies = policydao
-                .getPolicies((int) this.resource.getId(), this.user, null);
+        this.policies = policydao.getPolicies((int) this.resource.getId(),
+                this.user, null);
     }
 
+
     /**
      * standard function for READ access on the resource
-     *
+     * 
      * @return boolean is action allowed for resource
      */
-    public boolean isAllowed() {
+    public boolean isAllowed () {
         return evaluator.isAllowed();
     }
 
-    public boolean isAllowed(Permissions.Permission... perm) {
+
+    public boolean isAllowed (Permissions.Permission ... perm) {
         return evaluator.isAllowed();
     }
 
+
     /**
      * checks if that exact object already exists (compares name,
      * conditional parameter)
-     *
+     * 
      * @param policy
      * @return
      */
-    public boolean contains(SecurityPolicy policy) {
+    public boolean contains (SecurityPolicy policy) {
         try {
             return policydao.checkPolicy(policy, this.user) == 1;
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             return false;
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityRowMappers.java b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityRowMappers.java
index 0ab9cbd..5c36e5c 100644
--- a/src/main/java/de/ids_mannheim/korap/security/ac/SecurityRowMappers.java
+++ b/src/main/java/de/ids_mannheim/korap/security/ac/SecurityRowMappers.java
@@ -24,7 +24,7 @@
     public static class PolicyRowMapper implements RowMapper<SecurityPolicy> {
 
         @Override
-        public SecurityPolicy mapRow(ResultSet rs, int rowNum)
+        public SecurityPolicy mapRow (ResultSet rs, int rowNum)
                 throws SQLException {
             String perms = rs.getString("perm");
             SecurityPolicy p = new SecurityPolicy();
@@ -51,33 +51,37 @@
 
         private Map<String, Object> flags;
 
-        public FlagContext() {
+
+        public FlagContext () {
             this.flags = new HashMap<>();
         }
 
-        public FlagContext addFlag(String key, Object value) {
+
+        public FlagContext addFlag (String key, Object value) {
             this.flags.put(key, value);
             return this;
         }
 
-        public FlagContext removeFlag(String key) {
+
+        public FlagContext removeFlag (String key) {
             this.flags.remove(key);
             return this;
         }
 
-        public FlagContext clearFlags() {
+
+        public FlagContext clearFlags () {
             this.flags.clear();
             return this;
         }
     }
 
+
     @SuppressWarnings(value = "all")
-    public static List<SecurityPolicy>[] mapResourcePolicies(ResultSet rs)
+    public static List<SecurityPolicy>[] mapResourcePolicies (ResultSet rs)
             throws SQLException {
         List<SecurityPolicy>[] policyArray = null;
         List<Integer>[] idx = null;
-        loop:
-        while (rs.next()) {
+        loop: while (rs.next()) {
             // user has no permission here, thus skip
             if (rs.getInt("allowed") == 0)
                 continue loop;
@@ -102,13 +106,13 @@
             if (index == -1) {
                 if (pid == -1 && grouping.equalsIgnoreCase("self")) {
                     policy = new SecurityPolicy.OwnerPolicy(
-                            rs.getString("persistent_id"),
-                            rs.getInt("creator"));
+                            rs.getString("persistent_id"), rs.getInt("creator"));
                     policyArray[depth].add(0, policy);
                     idx[depth].add(0, pid);
-                }else {
-                    policy = new SecurityRowMappers.PolicyRowMapper()
-                            .mapRow(rs, 0);
+                }
+                else {
+                    policy = new SecurityRowMappers.PolicyRowMapper().mapRow(
+                            rs, 0);
                     policyArray[depth].add(policy);
                     idx[depth].add(pid);
 
@@ -118,7 +122,8 @@
                     //                        idx[depth].add(pid);
                     //                    }
                 }
-            }else
+            }
+            else
                 policy = policyArray[depth].get(index);
 
             PolicyCondition c = new PolicyCondition(rs.getString("group_id"));
@@ -128,7 +133,8 @@
         return policyArray;
     }
 
-    public static List<SecurityPolicy> mapConditionPolicies(ResultSet rs)
+
+    public static List<SecurityPolicy> mapConditionPolicies (ResultSet rs)
             throws SQLException {
         Map<Integer, SecurityPolicy> policyMap = new HashMap<>();
         while (rs.next()) {
@@ -149,8 +155,9 @@
         return new ArrayList<>(policyMap.values());
     }
 
+
     @Deprecated
-    public static List<SecurityPolicy>[] map(ResultSet rs) throws SQLException {
+    public static List<SecurityPolicy>[] map (ResultSet rs) throws SQLException {
         Map<Integer, SecurityPolicy>[] policyArray = null;
         while (rs.next()) {
             // user has no permission here!
@@ -181,7 +188,8 @@
         if (policyArray == null) {
             results = new List[1];
             results[0] = new ArrayList<>();
-        }else {
+        }
+        else {
             results = new List[policyArray.length];
             for (int idx = 0; idx < policyArray.length; idx++) {
                 if (policyArray[idx] != null)
@@ -193,17 +201,18 @@
         return results;
     }
 
-    public static class HierarchicalResultExtractor
-            implements ResultSetExtractor<List<KustvaktResource.Container>> {
+    public static class HierarchicalResultExtractor implements
+            ResultSetExtractor<List<KustvaktResource.Container>> {
 
         private boolean _withpid;
 
+
         //        public HierarchicalResultExtractor(boolean wpid) {
         //            this._withpid = wpid;
         //        }
 
         // todo: in order for this to work, all parent flags need to be matched in sql!
-        public List<KustvaktResource.Container> extractData(ResultSet rs)
+        public List<KustvaktResource.Container> extractData (ResultSet rs)
                 throws SQLException, DataAccessException {
             // contains the container with the highest available name_path to retrieve partial matches!
             PrefixTreeMap<KustvaktResource.Container[]> containerMap = new PrefixTreeMap<>();
@@ -219,30 +228,28 @@
                     String persistentId = rs.getString("persistent_id");
                     int depth = rs.getInt("depth");
                     String namePath = rs.getString("name_path");
-                    policy = new SecurityRowMappers.PolicyRowMapper()
-                            .mapRow(rs, 0);
+                    policy = new SecurityRowMappers.PolicyRowMapper().mapRow(
+                            rs, 0);
 
                     //todo: put active status here!
                     trace.put(pid, policy);
 
                     //fixme: since leaves are mentioned first, maybe retrieve
                     SortedMap<String, KustvaktResource.Container[]> submatch;
-                    if ((submatch = containerMap.getPrefixSubMap(namePath))
-                            == null) {
+                    if ((submatch = containerMap.getPrefixSubMap(namePath)) == null) {
                         //create container for last child node
                         cursor = new KustvaktResource.Container[depth + 1];
                         cursor[depth] = new KustvaktResource.Container(
-                                persistentId,
-                                ResourceFactory.getResource(rs.getInt("type"))
-                                        .getClass());
+                                persistentId, ResourceFactory.getResource(
+                                        rs.getInt("type")).getClass());
                         containerMap.put(namePath, cursor);
-                    }else {
+                    }
+                    else {
                         KustvaktResource.Container[] values = submatch
                                 .get(submatch.firstKey());
                         values[depth] = new KustvaktResource.Container(
-                                persistentId,
-                                ResourceFactory.getResource(rs.getInt("type"))
-                                        .getClass());
+                                persistentId, ResourceFactory.getResource(
+                                        rs.getInt("type")).getClass());
                     }
                 }
             }
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 297a36e..97b0e1b 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
@@ -10,6 +10,7 @@
 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.utils.NamingUtils;
 import de.ids_mannheim.korap.utils.StringUtils;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
@@ -24,48 +25,55 @@
 public class APIAuthentication implements AuthenticationIface {
 
     private JWTSigner signedToken;
-    private Cache invalided = CacheManager.getInstance()
-            .getCache("id_tokens_inv");
+    private Cache invalided = CacheManager.getInstance().getCache(
+            "id_tokens_inv");
     private Cache id_tokens = CacheManager.getInstance().getCache("id_tokens");
 
-    public APIAuthentication(KustvaktConfiguration bconfig) {
+
+    public APIAuthentication (KustvaktConfiguration bconfig) {
         KustvaktConfiguration config = bconfig;
         this.signedToken = new JWTSigner(config.getSharedSecret(),
                 config.getIssuer(), config.getTokenTTL());
     }
 
+
     //    @Cacheable(value = "id_tokens", key = "#authToken")
     // todo: test
     @Override
-    public TokenContext getUserStatus(String authToken)
+    public TokenContext getUserStatus (String authToken)
             throws KustvaktException {
         TokenContext context;
         Element e = id_tokens.get(authToken);
         Element ein = invalided.get(authToken);
         if (e == null && ein == null) {
             try {
-                authToken = StringUtils.stripTokenType(authToken);
+                authToken = NamingUtils.stripTokenType(authToken);
                 context = signedToken.getTokenContext(authToken);
                 context.setTokenType(Attributes.API_AUTHENTICATION);
-            }catch (JOSEException | ParseException ex) {
+            }
+            catch (JOSEException | ParseException ex) {
                 throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
             }
-        }else if (ein == null) {
+        }
+        else if (ein == null) {
             context = (TokenContext) e.getObjectValue();
-        }else
+        }
+        else
             throw new KustvaktException(StatusCodes.EXPIRED);
         return context;
     }
 
+
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession (User user, Map<String, Object> attr)
             throws KustvaktException {
         TokenContext c = new TokenContext();
         c.setUsername(user.getUsername());
         SignedJWT jwt = signedToken.createJWT(user, attr);
         try {
             c.setExpirationTime(jwt.getJWTClaimsSet().getExpirationTimeClaim());
-        }catch (ParseException e) {
+        }
+        catch (ParseException e) {
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
         }
         c.setTokenType(Attributes.API_AUTHENTICATION);
@@ -75,22 +83,25 @@
         return c;
     }
 
+
     // todo: cache and set expiration to token expiration. if token in that cache, it is not to be used anymore!
     // fixme: dont use annotations but function calls
     //    @CacheEvict(value = "id_tokens", key = "#token")
     @Override
-    public void removeUserSession(String token) throws KustvaktException {
+    public void removeUserSession (String token) throws KustvaktException {
         // invalidate token!
         invalided.put(new Element(token, null));
     }
 
+
     @Override
-    public TokenContext refresh(TokenContext context) throws KustvaktException {
+    public TokenContext refresh (TokenContext context) throws KustvaktException {
         return null;
     }
 
+
     @Override
-    public String getIdentifier() {
+    public String getIdentifier () {
         return Attributes.API_AUTHENTICATION;
     }
 
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 c93d6ec..16e0298 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
@@ -11,6 +11,7 @@
 import de.ids_mannheim.korap.user.KorAPUser;
 import de.ids_mannheim.korap.user.TokenContext;
 import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.utils.NamingUtils;
 import de.ids_mannheim.korap.utils.StringUtils;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.oltu.oauth2.common.utils.OAuthUtils;
@@ -23,7 +24,7 @@
  */
 public class BasicHttpAuth implements AuthenticationIface {
 
-    public static String[] decode(String token) {
+    public static String[] decode (String token) {
         return OAuthUtils.decodeClientAuthenticationHeader(token);
 
         //        String t = StringUtils.getTokenType(token);
@@ -38,16 +39,19 @@
         //        return null;
     }
 
-    public static String encode(String user, String pass) {
+
+    public static String encode (String user, String pass) {
         String s = user + ":" + pass;
-        return Attributes.BASIC_AUTHENTICATION + " " + new String(
-                Base64.encodeBase64(s.getBytes()));
+        return Attributes.BASIC_AUTHENTICATION + " "
+                + new String(Base64.encodeBase64(s.getBytes()));
     }
 
+
     @Override
-    public TokenContext getUserStatus(String authToken)
+    public TokenContext getUserStatus (String authToken)
             throws KustvaktException {
-        EncryptionIface crypto = BeansFactory.getKustvaktContext().getEncryption();
+        EncryptionIface crypto = BeansFactory.getKustvaktContext()
+                .getEncryption();
         EntityHandlerIface dao = BeansFactory.getKustvaktContext()
                 .getUserDBHandler();
         String[] values = decode(authToken);
@@ -55,8 +59,8 @@
             TokenContext c = new TokenContext();
             User user = dao.getAccount(values[0]);
             if (user instanceof KorAPUser) {
-                boolean check = crypto
-                        .checkHash(values[1], ((KorAPUser) user).getPassword());
+                boolean check = crypto.checkHash(values[1],
+                        ((KorAPUser) user).getPassword());
 
                 if (!check)
                     return null;
@@ -65,7 +69,7 @@
             c.setTokenType(Attributes.BASIC_AUTHENTICATION);
             // todo: for production mode, set true
             c.setSecureRequired(false);
-            c.setToken(StringUtils.stripTokenType(authToken));
+            c.setToken(NamingUtils.stripTokenType(authToken));
             //            fixme: you can make queries, but user sensitive data is off limits?!
             c.addContextParameter(Attributes.SCOPES,
                     Scopes.Scope.search.toString());
@@ -74,25 +78,29 @@
         return null;
     }
 
+
     // not supported!
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession (User user, Map<String, Object> attr)
             throws KustvaktException {
         return null;
     }
 
+
     @Override
-    public void removeUserSession(String token) throws KustvaktException {
+    public void removeUserSession (String token) throws KustvaktException {
         throw new KustvaktException(StatusCodes.NOT_SUPPORTED);
     }
 
+
     @Override
-    public TokenContext refresh(TokenContext context) throws KustvaktException {
+    public TokenContext refresh (TokenContext context) throws KustvaktException {
         return null;
     }
 
+
     @Override
-    public String getIdentifier() {
+    public String getIdentifier () {
         return Attributes.BASIC_AUTHENTICATION;
     }
 }
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 fe33683..28cb802 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,6 +12,7 @@
 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.NamingUtils;
 import de.ids_mannheim.korap.utils.StringUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import net.sf.ehcache.Cache;
@@ -28,9 +29,11 @@
 import java.util.Map;
 
 /**
- * contains the logic to authentication and registration processes. Uses
- * interface implementations (AuthenticationIface) for different databases and handlers
- *
+ * contains the logic to authentication and registration processes.
+ * Uses
+ * interface implementations (AuthenticationIface) for different
+ * databases and handlers
+ * 
  * @author hanl
  */
 public class KustvaktAuthenticationManager extends AuthenticationManagerIface {
@@ -46,9 +49,12 @@
     private LoginCounter counter;
     private Cache user_cache;
 
-    public KustvaktAuthenticationManager(EntityHandlerIface userdb,
-            EncryptionIface crypto, KustvaktConfiguration config,
-            AuditingIface auditer, Collection<UserDataDbIface> userdatadaos) {
+
+    public KustvaktAuthenticationManager (EntityHandlerIface userdb,
+                                          EncryptionIface crypto,
+                                          KustvaktConfiguration config,
+                                          AuditingIface auditer,
+                                          Collection<UserDataDbIface> userdatadaos) {
         this.user_cache = CacheManager.getInstance().getCache("users");
         this.entHandler = userdb;
         this.config = config;
@@ -58,21 +64,22 @@
         this.userdatadaos = userdatadaos;
     }
 
+
     /**
      * get session object if token was a session token
-     *
+     * 
      * @param token
      * @param host
      * @param useragent
      * @return
      * @throws KustvaktException
      */
-    public TokenContext getTokenStatus(String token, String host,
+    public TokenContext getTokenStatus (String token, String host,
             String useragent) throws KustvaktException {
         jlog.info("getting session status of token type '{}'",
                 token.split(" ")[0]);
         AuthenticationIface provider = getProvider(
-                StringUtils.getTokenType(token), null);
+                NamingUtils.getTokenType(token), null);
 
         if (provider == null)
             // throw exception for missing type paramter
@@ -85,7 +92,8 @@
         return context;
     }
 
-    public User getUser(String username) throws KustvaktException {
+
+    public User getUser (String username) throws KustvaktException {
         User user;
         String key = cache_key(username);
         Element e = user_cache.get(key);
@@ -96,7 +104,8 @@
         if (e != null) {
             Map map = (Map) e.getObjectValue();
             user = User.UserFactory.toUser(map);
-        }else {
+        }
+        else {
             user = entHandler.getAccount(username);
             user_cache.put(new Element(key, user.toCache()));
             // todo: not valid. for the duration of the session, the host should not change!
@@ -107,9 +116,9 @@
         return user;
     }
 
-    public TokenContext refresh(TokenContext context) throws KustvaktException {
-        AuthenticationIface provider = getProvider(context.getTokenType(),
-                null);
+
+    public TokenContext refresh (TokenContext context) throws KustvaktException {
+        AuthenticationIface provider = getProvider(context.getTokenType(), null);
         if (provider == null) {
             //todo:
         }
@@ -118,20 +127,25 @@
             provider.removeUserSession(context.getToken());
             User user = getUser(context.getUsername());
             return provider.createUserSession(user, context.params());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw new WrappedException(e, StatusCodes.LOGIN_FAILED);
         }
     }
 
+
     /**
      * @param type
-     * @param attributes contains username and password to authenticate the user.
-     *                   Depending of the authentication schema, may contain other values as well
+     * @param attributes
+     *            contains username and password to authenticate the
+     *            user.
+     *            Depending of the authentication schema, may contain
+     *            other values as well
      * @return User
      * @throws KustvaktException
      */
     @Override
-    public User authenticate(int type, String username, String password,
+    public User authenticate (int type, String username, String password,
             Map<String, Object> attributes) throws KustvaktException {
         User user;
         switch (type) {
@@ -143,17 +157,18 @@
                 user = authenticate(username, password, attributes);
                 break;
         }
-        auditing.audit(AuditRecord
-                .serviceRecord(user.getId(), StatusCodes.LOGIN_SUCCESSFUL,
-                        user.toString()));
+        auditing.audit(AuditRecord.serviceRecord(user.getId(),
+                StatusCodes.LOGIN_SUCCESSFUL, user.toString()));
         return user;
     }
 
+
     // todo: dont use annotations for caching
     @Override
     @CachePut(value = "users", key = "#user.getUsername()")
-    public TokenContext createTokenContext(User user, Map<String, Object> attr,
-            String provider_key) throws KustvaktException {
+    public TokenContext createTokenContext (User user,
+            Map<String, Object> attr, String provider_key)
+            throws KustvaktException {
         AuthenticationIface provider = getProvider(provider_key,
                 Attributes.API_AUTHENTICATION);
 
@@ -168,9 +183,10 @@
         return context;
     }
 
+
     //todo: test
     @Deprecated
-    private boolean matchStatus(String host, String useragent,
+    private boolean matchStatus (String host, String useragent,
             TokenContext context) {
         if (host.equals(context.getHostAddress())) {
             if (useragent.equals(context.getUserAgent()))
@@ -179,7 +195,8 @@
         return false;
     }
 
-    private User authenticateShib(Map<String, Object> 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);
@@ -198,8 +215,9 @@
         return user;
     }
 
+
     //todo: what if attributes null?
-    private User authenticate(String username, String password,
+    private User authenticate (String username, String password,
             Map<String, Object> attr) throws KustvaktException {
         Map<String, Object> attributes = crypto.validateMap(attr);
         String safeUS;
@@ -208,7 +226,8 @@
 
         try {
             safeUS = crypto.validateEntry(username, Attributes.USERNAME);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw new WrappedException(e, StatusCodes.LOGIN_FAILED, username);
         }
 
@@ -218,12 +237,14 @@
         else {
             try {
                 unknown = entHandler.getAccount(safeUS);
-            }catch (EmptyResultException e) {
+            }
+            catch (EmptyResultException e) {
                 // mask exception to disable user guessing in possible attacks
                 throw new WrappedException(new KustvaktException(username,
                         StatusCodes.BAD_CREDENTIALS), StatusCodes.LOGIN_FAILED,
                         username);
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 throw new WrappedException(e, StatusCodes.LOGIN_FAILED,
                         attributes.toString());
             }
@@ -231,9 +252,8 @@
         jlog.trace("Authentication: found username " + unknown.getUsername());
         if (unknown instanceof KorAPUser) {
             if (password == null || password.isEmpty())
-                throw new WrappedException(
-                        new KustvaktException(unknown.getId(),
-                                StatusCodes.BAD_CREDENTIALS),
+                throw new WrappedException(new KustvaktException(
+                        unknown.getId(), StatusCodes.BAD_CREDENTIALS),
                         StatusCodes.LOGIN_FAILED, username);
 
             KorAPUser user = (KorAPUser) unknown;
@@ -261,34 +281,33 @@
                                 "URI token is expired. Deleting account for user {}",
                                 user.getUsername());
                         deleteAccount(user);
-                        throw new WrappedException(
-                                new KustvaktException(unknown.getId(),
-                                        StatusCodes.EXPIRED,
-                                        "account confirmation uri has expired",
-                                        param.getUriFragment()),
+                        throw new WrappedException(new KustvaktException(
+                                unknown.getId(), StatusCodes.EXPIRED,
+                                "account confirmation uri has expired",
+                                param.getUriFragment()),
                                 StatusCodes.LOGIN_FAILED, username);
                     }
-                    throw new WrappedException(
-                            new KustvaktException(unknown.getId(),
-                                    StatusCodes.UNCONFIRMED_ACCOUNT),
+                    throw new WrappedException(new KustvaktException(
+                            unknown.getId(), StatusCodes.UNCONFIRMED_ACCOUNT),
                             StatusCodes.LOGIN_FAILED, username);
                 }
                 jlog.error("ACCESS DENIED: account not active for '{}'",
                         unknown.getUsername());
-                throw new WrappedException(
-                        new KustvaktException(unknown.getId(),
-                                StatusCodes.ACCOUNT_DEACTIVATED),
+                throw new WrappedException(new KustvaktException(
+                        unknown.getId(), StatusCodes.ACCOUNT_DEACTIVATED),
                         StatusCodes.LOGIN_FAILED, username);
             }
 
-        }else if (unknown instanceof ShibUser) {
+        }
+        else if (unknown instanceof ShibUser) {
             //todo
         }
         jlog.debug("Authentication done: " + safeUS);
         return unknown;
     }
 
-    public User isRegistered(String username) throws KustvaktException {
+
+    public User isRegistered (String username) throws KustvaktException {
         User user;
         if (username == null || username.isEmpty())
             throw new KustvaktException(username, StatusCodes.ILLEGAL_ARGUMENT,
@@ -296,11 +315,13 @@
 
         try {
             user = entHandler.getAccount(username);
-        }catch (EmptyResultException e) {
+        }
+        catch (EmptyResultException e) {
             jlog.debug("user does not exist ({})", username);
             return null;
 
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("KorAPException", e);
             throw new KustvaktException(username, StatusCodes.ILLEGAL_ARGUMENT,
                     "username invalid", username);
@@ -308,7 +329,8 @@
         return user;
     }
 
-    public void logout(TokenContext context) throws KustvaktException {
+
+    public void logout (TokenContext context) throws KustvaktException {
         String key = cache_key(context.getUsername());
         try {
             AuthenticationIface provider = getProvider(context.getTokenType(),
@@ -319,7 +341,8 @@
                 return;
             }
             provider.removeUserSession(context.getToken());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw new WrappedException(e, StatusCodes.LOGOUT_FAILED,
                     context.toString());
         }
@@ -328,22 +351,24 @@
         user_cache.remove(key);
     }
 
-    private void processLoginFail(User user) throws KustvaktException {
+
+    private void processLoginFail (User user) throws KustvaktException {
         counter.registerFail(user.getUsername());
         if (!counter.validate(user.getUsername())) {
             try {
                 this.lockAccount(user);
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 jlog.error("user account could not be locked!", e);
-                throw new WrappedException(e,
-                        StatusCodes.UPDATE_ACCOUNT_FAILED);
+                throw new WrappedException(e, StatusCodes.UPDATE_ACCOUNT_FAILED);
             }
             throw new WrappedException(new KustvaktException(user.getId(),
                     StatusCodes.ACCOUNT_DEACTIVATED), StatusCodes.LOGIN_FAILED);
         }
     }
 
-    public void lockAccount(User user) throws KustvaktException {
+
+    public void lockAccount (User user) throws KustvaktException {
         if (!(user instanceof KorAPUser))
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
 
@@ -353,8 +378,9 @@
         entHandler.updateAccount(u);
     }
 
-    public KorAPUser checkPasswordAllowance(KorAPUser user, String oldPassword,
-            String newPassword) throws KustvaktException {
+
+    public KorAPUser checkPasswordAllowance (KorAPUser user,
+            String oldPassword, String newPassword) throws KustvaktException {
         String dbPassword = user.getPassword();
 
         if (oldPassword.trim().equals(newPassword.trim())) {
@@ -373,7 +399,8 @@
 
         try {
             user.setPassword(crypto.produceSecureHash(newPassword));
-        }catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+        }
+        catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
             //            throw new KorAPException(StatusCodes.ILLEGAL_ARGUMENT,
             //                    "Creating password hash failed!", "password");
             throw new WrappedException(new KustvaktException(user.getId(),
@@ -384,50 +411,54 @@
         return user;
     }
 
+
     //fixme: use clientinfo for logging/auditing?! = from where did he access the reset function?
     @Override
-    public void resetPassword(String uriFragment, String username,
+    public void resetPassword (String uriFragment, String username,
             String newPassphrase) throws KustvaktException {
         String safeUser, safePass;
 
         try {
             safeUser = crypto.validateEntry(username, Attributes.USERNAME);
             safePass = crypto.validateEntry(newPassphrase, Attributes.PASSWORD);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Error", e);
             throw new WrappedException(new KustvaktException(username,
                     StatusCodes.ILLEGAL_ARGUMENT, "password invalid",
-                    newPassphrase), StatusCodes.PASSWORD_RESET_FAILED, username,
-                    newPassphrase);
+                    newPassphrase), StatusCodes.PASSWORD_RESET_FAILED,
+                    username, newPassphrase);
         }
 
         try {
             safePass = crypto.produceSecureHash(safePass);
-        }catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+        }
+        catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
             jlog.error("Encoding/Algorithm Error", e);
             throw new WrappedException(new KustvaktException(username,
                     StatusCodes.ILLEGAL_ARGUMENT, "password invalid",
-                    newPassphrase), StatusCodes.PASSWORD_RESET_FAILED, username,
-                    uriFragment, newPassphrase);
+                    newPassphrase), StatusCodes.PASSWORD_RESET_FAILED,
+                    username, uriFragment, newPassphrase);
         }
         int result = entHandler
                 .resetPassphrase(safeUser, uriFragment, safePass);
 
         if (result == 0)
-            throw new WrappedException(
-                    new KustvaktException(username, StatusCodes.EXPIRED,
-                            "URI fragment expired", uriFragment),
+            throw new WrappedException(new KustvaktException(username,
+                    StatusCodes.EXPIRED, "URI fragment expired", uriFragment),
                     StatusCodes.PASSWORD_RESET_FAILED, username, uriFragment);
         else if (result == 1)
             jlog.info("successfully reset password for user {}", safeUser);
     }
 
-    public void confirmRegistration(String uriFragment, String username)
+
+    public void confirmRegistration (String uriFragment, String username)
             throws KustvaktException {
         String safeUser;
         try {
             safeUser = crypto.validateEntry(username, Attributes.USERNAME);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("error", e);
             throw new WrappedException(e,
                     StatusCodes.ACCOUNT_CONFIRMATION_FAILED, username,
@@ -438,52 +469,54 @@
             User user;
             try {
                 user = entHandler.getAccount(username);
-            }catch (EmptyResultException e) {
+            }
+            catch (EmptyResultException e) {
                 throw new WrappedException(new KustvaktException(username,
                         StatusCodes.BAD_CREDENTIALS),
                         StatusCodes.ACCOUNT_CONFIRMATION_FAILED, username,
                         uriFragment);
             }
             entHandler.deleteAccount(user.getId());
-            throw new WrappedException(
-                    new KustvaktException(user.getId(), StatusCodes.EXPIRED),
+            throw new WrappedException(new KustvaktException(user.getId(),
+                    StatusCodes.EXPIRED),
                     StatusCodes.ACCOUNT_CONFIRMATION_FAILED, username,
                     uriFragment);
-        }else if (r == 1)
+        }
+        else if (r == 1)
             jlog.info("successfully confirmed user registration for user {}",
                     safeUser);
         // register successful audit!
     }
 
+
     /**
      * @param attributes
      * @return
      * @throws KustvaktException
      */
     //fixme: remove clientinfo object (not needed), use json representation to get stuff
-    public User createUserAccount(Map<String, Object> 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())
+        if (safeMap.get(Attributes.USERNAME) == null
+                || ((String) safeMap.get(Attributes.USERNAME)).isEmpty())
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                     "username must be set", "username");
-        if (safeMap.get(Attributes.PASSWORD) == null || ((String) safeMap
-                .get(Attributes.PASSWORD)).isEmpty())
+        if (safeMap.get(Attributes.PASSWORD) == null
+                || ((String) safeMap.get(Attributes.PASSWORD)).isEmpty())
             throw new KustvaktException(safeMap.get(Attributes.USERNAME),
                     StatusCodes.ILLEGAL_ARGUMENT, "password must be set",
                     "password");
 
-        String username = crypto
-                .validateEntry((String) safeMap.get(Attributes.USERNAME),
-                        Attributes.USERNAME);
-        String safePass = crypto
-                .validateEntry((String) 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);
-        }catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
+        }
+        catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
             jlog.error("Encryption error", e);
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
         }
@@ -495,8 +528,8 @@
 
         user.setAccountLocked(confirmation_required);
         if (confirmation_required) {
-            URIParam param = new URIParam(crypto.createToken(),
-                    TimeUtils.plusSeconds(config.getExpiration()).getMillis());
+            URIParam param = new URIParam(crypto.createToken(), TimeUtils
+                    .plusSeconds(config.getExpiration()).getMillis());
             user.addField(param);
         }
         user.setPassword(hash);
@@ -512,15 +545,16 @@
             settings.readDefaults(safeMap);
             settings.checkRequired();
 
-            UserDataDbIface dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(userdatadaos, UserDetails.class);
+            UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                    userdatadaos, UserDetails.class);
             assert dao != null;
             dao.store(details);
-            dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(userdatadaos, UserSettings.class);
+            dao = BeansFactory.getTypeFactory().getTypedBean(userdatadaos,
+                    UserSettings.class);
             assert dao != null;
             dao.store(settings);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw new WrappedException(e, StatusCodes.CREATE_ACCOUNT_FAILED,
                     user.toString());
         }
@@ -530,18 +564,19 @@
         return user;
     }
 
+
     //todo:
-    private ShibUser createShibbUserAccount(Map<String, Object> attributes)
+    private ShibUser createShibbUserAccount (Map<String, Object> attributes)
             throws KustvaktException {
         jlog.debug("creating shibboleth user account for user attr: {}",
                 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
-                .getShibInstance((String) safeMap.get(Attributes.EPPN),
-                        (String) safeMap.get(Attributes.MAIL),
-                        (String) safeMap.get(Attributes.CN));
+        ShibUser user = User.UserFactory.getShibInstance(
+                (String) safeMap.get(Attributes.EPPN),
+                (String) safeMap.get(Attributes.MAIL),
+                (String) safeMap.get(Attributes.CN));
         user.setAffiliation((String) safeMap.get(Attributes.EDU_AFFIL));
         user.setAccountCreation(TimeUtils.getNow().getMillis());
         entHandler.createAccount(user);
@@ -550,8 +585,8 @@
         d.readDefaults(attributes);
         d.checkRequired();
 
-        UserDataDbIface dao = BeansFactory.getTypeFactory()
-                .getTypedBean(userdatadaos, UserDetails.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                userdatadaos, UserDetails.class);
         assert dao != null;
         dao.store(d);
 
@@ -559,27 +594,33 @@
         s.readDefaults(attributes);
         s.checkRequired();
 
-        dao = BeansFactory.getTypeFactory()
-                .getTypedBean(userdatadaos, UserSettings.class);
+        dao = BeansFactory.getTypeFactory().getTypedBean(userdatadaos,
+                UserSettings.class);
         assert dao != null;
         dao.store(d);
 
         return user;
     }
 
+
     /**
      * link shibboleth and korap user account to one another.
-     *
-     * @param current    currently logged in user
-     * @param for_name   foreign user name the current account should be linked to
-     * @param transstrat transfer status of user data (details, settings, user queries)
-     *                   0 = the currently logged in data should be kept
-     *                   1 = the foreign account data should be kept
+     * 
+     * @param current
+     *            currently logged in user
+     * @param for_name
+     *            foreign user name the current account should be
+     *            linked to
+     * @param transstrat
+     *            transfer status of user data (details, settings,
+     *            user queries)
+     *            0 = the currently logged in data should be kept
+     *            1 = the foreign account data should be kept
      * @throws NotAuthorizedException
      * @throws KustvaktException
      */
     // todo:
-    public void accountLink(User current, String for_name, int transstrat)
+    public void accountLink (User current, String for_name, int transstrat)
             throws KustvaktException {
         //        User foreign = entHandler.getAccount(for_name);
 
@@ -606,7 +647,8 @@
         //        }
     }
 
-    public boolean updateAccount(User user) throws KustvaktException {
+
+    public boolean updateAccount (User user) throws KustvaktException {
         boolean result;
         String key = cache_key(user.getUsername());
         if (user instanceof DemoUser)
@@ -617,10 +659,10 @@
             //            crypto.validate(user);
             try {
                 result = entHandler.updateAccount(user) > 0;
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 jlog.error("Error ", e);
-                throw new WrappedException(e,
-                        StatusCodes.UPDATE_ACCOUNT_FAILED);
+                throw new WrappedException(e, StatusCodes.UPDATE_ACCOUNT_FAILED);
             }
         }
         if (result) {
@@ -631,7 +673,8 @@
         return result;
     }
 
-    public boolean deleteAccount(User user) throws KustvaktException {
+
+    public boolean deleteAccount (User user) throws KustvaktException {
         boolean result;
         String key = cache_key(user.getUsername());
         if (user instanceof DemoUser)
@@ -639,10 +682,10 @@
         else {
             try {
                 result = entHandler.deleteAccount(user.getId()) > 0;
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 jlog.error("Error ", e);
-                throw new WrappedException(e,
-                        StatusCodes.DELETE_ACCOUNT_FAILED);
+                throw new WrappedException(e, StatusCodes.DELETE_ACCOUNT_FAILED);
             }
         }
         if (result) {
@@ -653,7 +696,8 @@
         return result;
     }
 
-    public Object[] validateResetPasswordRequest(String username, String email)
+
+    public Object[] validateResetPasswordRequest (String username, String email)
             throws KustvaktException {
         String mail, uritoken;
         mail = crypto.validateEntry(email, Attributes.EMAIL);
@@ -665,7 +709,8 @@
                 //                    "password reset now allowed for DemoUser", "");
                 throw new WrappedException(username,
                         StatusCodes.PASSWORD_RESET_FAILED, username);
-        }catch (EmptyResultException e) {
+        }
+        catch (EmptyResultException e) {
             throw new WrappedException(new KustvaktException(username,
                     StatusCodes.ILLEGAL_ARGUMENT, "username not found",
                     username), StatusCodes.PASSWORD_RESET_FAILED, username);
@@ -681,57 +726,66 @@
                     StatusCodes.ILLEGAL_ARGUMENT, "email invalid", email),
                     StatusCodes.PASSWORD_RESET_FAILED, email);
         uritoken = crypto.encodeBase();
-        URIParam param = new URIParam(uritoken,
-                TimeUtils.plusHours(24).getMillis());
+        URIParam param = new URIParam(uritoken, TimeUtils.plusHours(24)
+                .getMillis());
         user.addField(param);
 
         try {
             entHandler.updateAccount(user);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Error ", e);
             throw new WrappedException(e, StatusCodes.PASSWORD_RESET_FAILED);
         }
-        return new Object[] { uritoken,
-                new DateTime(param.getUriExpiration()) };
+        return new Object[] { uritoken, new DateTime(param.getUriExpiration()) };
     }
 
+
     @Override
-    public <T extends Userdata> T getUserData(User user, Class<T> clazz)
+    public <T extends Userdata> T getUserData (User user, Class<T> clazz)
             throws WrappedException {
 
         try {
-            UserDataDbIface<T> dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(BeansFactory.getKustvaktContext().getUserDataDaos(), clazz);
+            UserDataDbIface<T> dao = BeansFactory
+                    .getTypeFactory()
+                    .getTypedBean(
+                            BeansFactory.getKustvaktContext().getUserDataDaos(),
+                            clazz);
             T data = null;
             if (dao != null)
                 data = dao.get(user);
 
             if (data == null)
                 throw new WrappedException(user.getId(),
-                            StatusCodes.EMPTY_RESULTS, clazz.getSimpleName());
-                return data;
-        }catch (KustvaktException e) {
+                        StatusCodes.EMPTY_RESULTS, clazz.getSimpleName());
+            return data;
+        }
+        catch (KustvaktException e) {
             jlog.error("Error ", e);
             throw new WrappedException(e, StatusCodes.GET_ACCOUNT_FAILED);
         }
     }
 
+
     //todo: cache userdata outside of the user object!
     @Override
-    public void updateUserData(Userdata data) throws WrappedException {
+    public void updateUserData (Userdata data) throws WrappedException {
         try {
 
             data.validate(this.crypto);
-            UserDataDbIface dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(BeansFactory.getKustvaktContext().getUserDataDaos(), data.getClass());
+            UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                    BeansFactory.getKustvaktContext().getUserDataDaos(),
+                    data.getClass());
             if (dao != null)
                 dao.update(data);
-        }catch (KustvaktException e) {
+        }
+        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)
@@ -752,10 +806,11 @@
     //        return user.getSettings();
     //    }
 
-    private String cache_key(String input) throws KustvaktException {
+    private String cache_key (String input) throws KustvaktException {
         try {
             return crypto.hash(KEY + "@" + input);
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             jlog.error("illegal cache key input '{}'", input);
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT,
                     "missing or illegal cache key", input);
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java b/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java
index 7f6ae2d..1ae589b 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/LoginCounter.java
@@ -19,17 +19,20 @@
     private final Map<String, Long[]> failedLogins;
     private KustvaktConfiguration config;
 
-    public LoginCounter(KustvaktConfiguration config) {
+
+    public LoginCounter (KustvaktConfiguration config) {
         jlog.debug("init login counter for authentication management");
         this.config = config;
         this.failedLogins = new HashMap<>();
     }
 
-    public void resetFailedCounter(String username) {
+
+    public void resetFailedCounter (String username) {
         failedLogins.remove(username);
     }
 
-    public void registerFail(String username) {
+
+    public void registerFail (String username) {
         long expires = TimeUtils.plusSeconds(config.getLoginAttemptTTL())
                 .getMillis();
         long fail = 1;
@@ -46,13 +49,15 @@
                 Arrays.asList(failedLogins.get(username)));
     }
 
-    public boolean validate(String username) {
+
+    public boolean validate (String username) {
         Long[] set = failedLogins.get(username);
         if (set != null) {
             if (TimeUtils.isPassed(set[1])) {
                 failedLogins.remove(username);
                 return true;
-            }else if (set[0] < config.getLoginAttemptNum())
+            }
+            else if (set[0] < config.getLoginAttemptNum())
                 return true;
             return false;
         }
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 3f0ebe4..98a8268 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
@@ -11,6 +11,7 @@
 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.utils.NamingUtils;
 import de.ids_mannheim.korap.utils.StringUtils;
 import net.sf.ehcache.CacheManager;
 import net.sf.ehcache.Element;
@@ -29,22 +30,25 @@
     private OAuthDb database;
     private KustvaktConfiguration config;
 
-    public OpenIDconnectAuthentication(KustvaktConfiguration config,
-            PersistenceClient client) {
+
+    public OpenIDconnectAuthentication (KustvaktConfiguration config,
+                                        PersistenceClient client) {
         this.database = new OAuthDb(client);
         this.config = config;
     }
 
+
     @Cacheable(value = "id_tokens", key = "#authToken")
     @Override
-    public TokenContext getUserStatus(String authToken)
+    public TokenContext getUserStatus (String authToken)
             throws KustvaktException {
-        authToken = StringUtils.stripTokenType(authToken);
+        authToken = NamingUtils.stripTokenType(authToken);
         return this.database.getContext(authToken);
     }
 
+
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession (User user, Map<String, Object> attr)
             throws KustvaktException {
         String cl_secret = (String) attr.get(Attributes.CLIENT_SECRET);
         if (cl_secret == null)
@@ -57,7 +61,8 @@
         SignedJWT jwt = signer.createJWT(user, attr);
         try {
             c.setExpirationTime(jwt.getJWTClaimsSet().getExpirationTimeClaim());
-        }catch (ParseException e) {
+        }
+        catch (ParseException e) {
             throw new KustvaktException(StatusCodes.ILLEGAL_ARGUMENT);
         }
         c.setTokenType(Attributes.OPENID_AUTHENTICATION);
@@ -67,19 +72,22 @@
         return c;
     }
 
+
     @CacheEvict(value = "id_tokens", key = "#token")
     @Override
-    public void removeUserSession(String token) throws KustvaktException {
+    public void removeUserSession (String token) throws KustvaktException {
         // emit token from cache only
     }
 
+
     @Override
-    public TokenContext refresh(TokenContext context) throws KustvaktException {
+    public TokenContext refresh (TokenContext context) throws KustvaktException {
         throw new UnsupportedOperationException("method not supported");
     }
 
+
     @Override
-    public String getIdentifier() {
+    public String getIdentifier () {
         return Attributes.OPENID_AUTHENTICATION;
     }
 }
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 68b04c8..ceb1284 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
@@ -18,9 +18,10 @@
 import java.util.concurrent.TimeUnit;
 
 /**
- * implementation of the AuthenticationIface to handle korap authentication
+ * implementation of the AuthenticationIface to handle korap
+ * authentication
  * internals
- *
+ * 
  * @author hanl
  */
 public class SessionAuthentication implements AuthenticationIface {
@@ -32,8 +33,9 @@
     private EncryptionIface crypto;
     private KustvaktConfiguration config;
 
-    public SessionAuthentication(KustvaktConfiguration config,
-            EncryptionIface crypto) {
+
+    public SessionAuthentication (KustvaktConfiguration config,
+                                  EncryptionIface crypto) {
         jlog.info("initialize session authentication handler");
         this.crypto = crypto;
         this.config = config;
@@ -45,24 +47,25 @@
                 this.config.getInactiveTime(), TimeUnit.SECONDS);
     }
 
+
     @Override
-    public TokenContext getUserStatus(String authenticationToken)
+    public TokenContext getUserStatus (String authenticationToken)
             throws KustvaktException {
-        jlog.debug("retrieving user session for user '{}'",
-                authenticationToken);
+        jlog.debug("retrieving user session for user '{}'", authenticationToken);
         if (authenticationToken == null)
             throw new KustvaktException(StatusCodes.PERMISSION_DENIED);
         return this.sessions.getSession(authenticationToken);
     }
 
+
     @Override
-    public TokenContext createUserSession(User user, Map<String, Object> attr)
+    public TokenContext createUserSession (User user, Map<String, Object> attr)
             throws KustvaktException {
         DateTime now = TimeUtils.getNow();
-        DateTime ex = TimeUtils
-                .getExpiration(now.getMillis(), config.getExpiration());
-        String token = crypto
-                .createToken(true, user.getUsername(), now.getMillis());
+        DateTime ex = TimeUtils.getExpiration(now.getMillis(),
+                config.getExpiration());
+        String token = crypto.createToken(true, user.getUsername(),
+                now.getMillis());
         TokenContext ctx = new TokenContext();
         ctx.setUsername(user.getUsername());
         ctx.setTokenType(Attributes.SESSION_AUTHENTICATION);
@@ -75,18 +78,21 @@
         return ctx;
     }
 
+
     @Override
-    public void removeUserSession(String token) {
+    public void removeUserSession (String token) {
         this.sessions.removeSession(token);
     }
 
+
     @Override
-    public TokenContext refresh(TokenContext context) throws KustvaktException {
+    public TokenContext refresh (TokenContext context) throws KustvaktException {
         throw new UnsupportedOperationException("method not supported");
     }
 
+
     @Override
-    public String getIdentifier() {
+    public String getIdentifier () {
         return Attributes.SESSION_AUTHENTICATION;
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java b/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java
index 34070b5..131f0b1 100644
--- a/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/security/auth/SessionFactory.java
@@ -19,10 +19,12 @@
 import java.util.concurrent.ConcurrentMap;
 
 /**
- * session object to hold current user sessions and track inactive time to close
- * unused sessions. Inactive sessions are not enforced until user makes a
+ * session object to hold current user sessions and track inactive
+ * time to close
+ * unused sessions. Inactive sessions are not enforced until user
+ * makes a
  * request through thrift
- *
+ * 
  * @author hanl
  */
 //todo: use simple ehcache!
@@ -37,7 +39,8 @@
     private final boolean multipleEnabled;
     private final int inactive;
 
-    public SessionFactory(boolean multipleEnabled, int inactive) {
+
+    public SessionFactory (boolean multipleEnabled, int inactive) {
         jlog.debug("allow multiple sessions per user: '{}'", multipleEnabled);
         this.multipleEnabled = multipleEnabled;
         this.inactive = inactive;
@@ -46,43 +49,50 @@
         this.loggedInRecord = new ConcurrentMultiMap<>();
     }
 
-    public boolean hasSession(TokenContext context) {
+
+    public boolean hasSession (TokenContext context) {
         if (context.getUsername().equalsIgnoreCase(DemoUser.DEMOUSER_NAME))
             return false;
         return loggedInRecord.containsKey(context.getUsername())
                 && !loggedInRecord.get(context.getUsername()).isEmpty();
     }
 
+
     @Cacheable("session")
-    public TokenContext getSession(String token) throws KustvaktException {
+    public TokenContext getSession (String token) throws KustvaktException {
         jlog.debug("logged in users: {}", loggedInRecord);
         TokenContext context = sessionsObject.get(token);
         if (context != null) {
             if (isUserSessionValid(token)) {
                 resetInterval(token);
                 return context;
-            }else
+            }
+            else
                 throw new KustvaktException(StatusCodes.EXPIRED);
 
-        }else
+        }
+        else
             throw new KustvaktException(StatusCodes.PERMISSION_DENIED);
     }
 
+
     //todo: ?!
     @CacheEvict(value = "session", key = "#session.token")
-    public void putSession(final String token, final TokenContext activeUser)
+    public void putSession (final String token, final TokenContext activeUser)
             throws KustvaktException {
         if (!hasSession(activeUser) | multipleEnabled) {
             loggedInRecord.put(activeUser.getUsername(), token);
             sessionsObject.put(token, activeUser);
             timeCheck.put(token, TimeUtils.getNow());
-        }else {
+        }
+        else {
             removeAll(activeUser);
             throw new KustvaktException(StatusCodes.ALREADY_LOGGED_IN);
         }
     }
 
-    public void removeAll(final TokenContext activeUser) {
+
+    public void removeAll (final TokenContext activeUser) {
         for (String existing : loggedInRecord.get(activeUser.getUsername())) {
             timeCheck.remove(existing);
             sessionsObject.remove(existing);
@@ -90,8 +100,9 @@
         loggedInRecord.remove(activeUser.getUsername());
     }
 
+
     @CacheEvict(value = "session", key = "#session.token")
-    public void removeSession(String token) {
+    public void removeSession (String token) {
         String username = sessionsObject.get(token).getUsername();
         loggedInRecord.remove(username, token);
         if (loggedInRecord.get(username).isEmpty())
@@ -100,39 +111,42 @@
         sessionsObject.remove(token);
     }
 
+
     /**
      * reset inactive time interval to 0
-     *
+     * 
      * @param token
      */
-    private void resetInterval(String token) {
+    private void resetInterval (String token) {
         timeCheck.put(token, TimeUtils.getNow());
     }
 
+
     /**
      * if user possesses a valid non-expired session token
-     *
+     * 
      * @param token
      * @return validity of user to request a backend function
      */
-    private boolean isUserSessionValid(String token) {
+    private boolean isUserSessionValid (String token) {
         if (timeCheck.containsKey(token)) {
-            if (TimeUtils
-                    .plusSeconds(timeCheck.get(token).getMillis(), inactive)
-                    .isAfterNow()) {
+            if (TimeUtils.plusSeconds(timeCheck.get(token).getMillis(),
+                    inactive).isAfterNow()) {
                 jlog.debug("user has session");
                 return true;
-            }else
+            }
+            else
                 jlog.debug("user with token {} has an invalid session", token);
         }
         return false;
     }
 
+
     /**
      * clean inactive sessions from session object
      * TODO: persist userdata to database when session times out!
      */
-    private void timeoutMaintenance() {
+    private void timeoutMaintenance () {
         jlog.trace("running session cleanup thread");
         Set<String> inactive = new HashSet<>();
         for (Entry<String, DateTime> entry : timeCheck.entrySet()) {
@@ -150,11 +164,12 @@
                     inactive);
     }
 
+
     /**
      * run cleanup-thread
      */
     @Override
-    public void run() {
+    public void run () {
         timeoutMaintenance();
         if (loggedInRecord.size() > 0)
             jlog.debug("logged users: {}", loggedInRecord.toString());
diff --git a/src/main/java/de/ids_mannheim/korap/user/Attributes.java b/src/main/java/de/ids_mannheim/korap/user/Attributes.java
index 3fe16bd..9d4761b 100644
--- a/src/main/java/de/ids_mannheim/korap/user/Attributes.java
+++ b/src/main/java/de/ids_mannheim/korap/user/Attributes.java
@@ -160,4 +160,3 @@
     //    public static final String
 
 }
-
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 cdb6671..2be2efb 100644
--- a/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
+++ b/src/main/java/de/ids_mannheim/korap/user/DemoUser.java
@@ -14,13 +14,15 @@
     private static final long ACCOUNT_CREATED = 1377102171202L;
     public static final String PASSPHRASE = "demo";
 
-    protected DemoUser() {
+
+    protected DemoUser () {
         super(DEMOUSER_NAME, 2);
         this.setId(-1);
         this.setAccountCreation(ACCOUNT_CREATED);
     }
 
-    protected User clone() {
+
+    protected User clone () {
         return new DemoUser();
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java b/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
index 87ec899..9c544f6 100644
--- a/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
+++ b/src/main/java/de/ids_mannheim/korap/user/KorAPUser.java
@@ -18,45 +18,49 @@
     private String URIFragment;
     private Long URIExpiration;
 
-    protected KorAPUser(String username) {
+
+    protected KorAPUser (String username) {
         super(username, 0);
         this.URIFragment = "";
         this.URIExpiration = 0L;
     }
 
-    public KorAPUser(Integer id, String username) {
+
+    public KorAPUser (Integer id, String username) {
         this(username);
         this.setId(id);
     }
 
-    public KorAPUser() {
+
+    public KorAPUser () {
         super();
     }
 
+
     @Override
-    protected User clone() {
+    protected User clone () {
         KorAPUser user = new KorAPUser(this.getUsername());
         user.setUsername(this.getUsername());
         user.setAccountCreation(this.getAccountCreation());
         return user;
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         int result = super.hashCode();
         result = 31 * result + (jlog != null ? jlog.hashCode() : 0);
         result = 31 * result + (password != null ? password.hashCode() : 0);
-        result = 31 * result + (URIFragment != null ?
-                URIFragment.hashCode() :
-                0);
-        result = 31 * result + (URIExpiration != null ?
-                URIExpiration.hashCode() :
-                0);
+        result = 31 * result
+                + (URIFragment != null ? URIFragment.hashCode() : 0);
+        result = 31 * result
+                + (URIExpiration != null ? URIExpiration.hashCode() : 0);
         return result;
     }
 
+
     @Override
-    public boolean equals(Object o) {
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (!(o instanceof KorAPUser))
@@ -67,9 +71,8 @@
         KorAPUser korAPUser = (KorAPUser) o;
         if (URIExpiration != korAPUser.URIExpiration)
             return false;
-        if (URIFragment != null ?
-                !URIFragment.equals(korAPUser.URIFragment) :
-                korAPUser.URIFragment != null)
+        if (URIFragment != null ? !URIFragment.equals(korAPUser.URIFragment)
+                : korAPUser.URIFragment != null)
             return false;
         return true;
     }
diff --git a/src/main/java/de/ids_mannheim/korap/user/ShibUser.java b/src/main/java/de/ids_mannheim/korap/user/ShibUser.java
index f3f60b1..d994721 100644
--- a/src/main/java/de/ids_mannheim/korap/user/ShibUser.java
+++ b/src/main/java/de/ids_mannheim/korap/user/ShibUser.java
@@ -14,11 +14,14 @@
     private String affiliation;
     private String cn;
 
-    protected ShibUser() {
+
+    protected ShibUser () {
         super(1);
     }
 
-    private ShibUser(String eduPersonID, String mail, String cn, String affiliation) {
+
+    private ShibUser (String eduPersonID, String mail, String cn,
+                      String affiliation) {
         this(eduPersonID);
         this.setUsername(eduPersonID);
         this.mail = mail;
@@ -26,13 +29,15 @@
         this.cn = cn;
     }
 
-    public ShibUser(String username) {
+
+    public ShibUser (String username) {
         super(username, 1);
 
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         final StringBuffer sb = new StringBuffer("ShibUser{");
         sb.append(", mail='").append(mail).append('\'');
         sb.append(", affiliation='").append(affiliation).append('\'');
@@ -41,8 +46,10 @@
         return sb.toString();
     }
 
+
     @Override
-    protected User clone() {
-        return new ShibUser(this.getUsername(), this.getMail(), this.getCn(), this.getAffiliation());
+    protected User clone () {
+        return new ShibUser(this.getUsername(), this.getMail(), this.getCn(),
+                this.getAffiliation());
     }
 }
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 bdc2d36..8cf5ad8 100644
--- a/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
+++ b/src/main/java/de/ids_mannheim/korap/user/TokenContext.java
@@ -37,14 +37,16 @@
     private String hostAddress;
     private String userAgent;
 
-    public TokenContext() {
+
+    public TokenContext () {
         this.parameters = new HashMap<>();
         this.setUsername("");
         this.setToken("");
         this.setSecureRequired(false);
     }
 
-    private Map statusMap() {
+
+    private Map statusMap () {
         Map m = new HashMap();
         if (username != null && !username.isEmpty())
             m.put(Attributes.USERNAME, username);
@@ -54,11 +56,13 @@
         return m;
     }
 
-    public Map<String, Object> params() {
+
+    public Map<String, Object> params () {
         return new HashMap<>(parameters);
     }
 
-    public boolean match(TokenContext other) {
+
+    public boolean match (TokenContext other) {
         if (other.getToken().equals(this.token))
             if (this.getHostAddress().equals(this.hostAddress))
                 // user agent should be irrelvant -- what about os system version?
@@ -67,25 +71,30 @@
         return false;
     }
 
-    public void addContextParameter(String key, String value) {
+
+    public void addContextParameter (String key, String value) {
         this.parameters.put(key, value);
     }
 
-    public void addParams(Map<String, Object> map) {
+
+    public void addParams (Map<String, Object> map) {
         for (Map.Entry<String, Object> e : map.entrySet())
             this.parameters.put(e.getKey(), String.valueOf(e.getValue()));
     }
 
-    public void removeContextParameter(String key) {
+
+    public void removeContextParameter (String key) {
         this.parameters.remove(key);
     }
 
-    public void setExpirationTime(long date) {
+
+    public void setExpirationTime (long date) {
         this.expirationTime = new Date(date);
     }
 
+
     //todo: complete
-    public static TokenContext fromJSON(String s) {
+    public static TokenContext fromJSON (String s) {
         JsonNode node = JsonUtils.readTree(s);
         TokenContext c = new TokenContext();
         if (node != null) {
@@ -95,35 +104,40 @@
         return c;
     }
 
-    public static TokenContext fromOAuth2(String s) {
+
+    public static TokenContext fromOAuth2 (String s) {
         JsonNode node = JsonUtils.readTree(s);
         TokenContext c = new TokenContext();
         if (node != null) {
             c.setToken(node.path("token").asText());
             c.setTokenType(node.path("token_type").asText());
             c.setExpirationTime(node.path("expires_in").asLong());
-            c.addContextParameter("refresh_token",
-                    node.path("refresh_token").asText());
+            c.addContextParameter("refresh_token", node.path("refresh_token")
+                    .asText());
 
         }
         return c;
     }
 
-    public boolean isValid() {
-        return (this.username != null && !this.username.isEmpty()) && (
-                this.token != null && !this.token.isEmpty()) && (
-                this.tokenType != null && !this.tokenType.isEmpty());
+
+    public boolean isValid () {
+        return (this.username != null && !this.username.isEmpty())
+                && (this.token != null && !this.token.isEmpty())
+                && (this.tokenType != null && !this.tokenType.isEmpty());
     }
 
-    public String getToken() {
+
+    public String getToken () {
         return token;
     }
 
-    public String toJSON() {
+
+    public String toJSON () {
         return JsonUtils.toJSON(this.statusMap());
     }
 
-    public String toResponse() {
+
+    public String toResponse () {
         ObjectNode node = JsonUtils.createObjectNode();
         node.put("token", this.getToken());
         node.put("expires", this.getExpirationTime().getTime());
@@ -131,8 +145,9 @@
         return JsonUtils.toJSON(node);
     }
 
+
     @Override
-    public String getName() {
+    public String getName () {
         return this.getUsername();
     }
 
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 8161254..99f52d1 100644
--- a/src/main/java/de/ids_mannheim/korap/user/User.java
+++ b/src/main/java/de/ids_mannheim/korap/user/User.java
@@ -43,7 +43,8 @@
 
     private List<Userdata> userdata;
 
-    protected User() {
+
+    protected User () {
         this.fields = new ParamFields();
         this.accountCreation = TimeUtils.getNow().getMillis();
         this.isAccountLocked = false;
@@ -52,25 +53,30 @@
         this.userdata = new ArrayList<>();
     }
 
-    protected User(int type) {
+
+    protected User (int type) {
         this();
         this.type = type;
     }
 
-    protected User(String username, int type) {
+
+    protected User (String username, int type) {
         this(type);
         this.username = username;
     }
 
-    public void addField(ParamFields.Param param) {
+
+    public void addField (ParamFields.Param param) {
         this.fields.add(param);
     }
 
-    public <T extends ParamFields.Param> T getField(Class<T> cl) {
+
+    public <T extends ParamFields.Param> T getField (Class<T> cl) {
         return this.fields.get(cl);
     }
 
-    public void addUserData(Userdata data) {
+
+    public void addUserData (Userdata data) {
         if (data != null) {
             for (Userdata d : this.userdata) {
                 // already has an object of that type!
@@ -81,7 +87,8 @@
         }
     }
 
-    public void setId(Integer id) {
+
+    public void setId (Integer id) {
         this.id = id;
         //        if (this.settings != null)
         //            this.settings.setUserID(this.id);
@@ -89,7 +96,8 @@
         //            this.details.setUserID(this.id);
     }
 
-    public Map<String, Object> toMap() {
+
+    public Map<String, Object> toMap () {
         Map map = new HashMap();
         map.put(Attributes.USERNAME, this.username);
         //TimeUtils.format(new DateTime(this.accountCreation))
@@ -100,7 +108,8 @@
         return map;
     }
 
-    public Map toCache() {
+
+    public Map toCache () {
         Map map = new HashMap();
         map.put(Attributes.ID, this.id);
         map.put(Attributes.USERNAME, this.username);
@@ -111,8 +120,9 @@
         return map;
     }
 
+
     @Override
-    public boolean equals(Object o) {
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (!(o instanceof User))
@@ -123,14 +133,17 @@
         return true;
     }
 
-    public boolean isAdmin() {
+
+    public boolean isAdmin () {
         return this.getUsername().equals(ADMINISTRATOR_ID);
     }
 
-    protected abstract User clone();
+
+    protected abstract User clone ();
+
 
     @Override
-    public String toString() {
+    public String toString () {
         final StringBuffer sb = new StringBuffer();
         sb.append("id='").append(id).append('\'');
         sb.append(", username='").append(username).append('\'');
@@ -139,36 +152,42 @@
 
     public static class UserFactory {
 
-        public static KorAPUser getUser(String username) {
+        public static KorAPUser getUser (String username) {
             return new KorAPUser(username);
         }
 
-        public static KorAPUser getUser(String username, String password) {
+
+        public static KorAPUser getUser (String username, String password) {
             KorAPUser user = new KorAPUser(username);
             user.setPassword(password);
             return user;
         }
 
-        public static KorAPUser getAdmin() {
+
+        public static KorAPUser getAdmin () {
             return new KorAPUser(ADMINISTRATOR_ID, ADMINISTRATOR_NAME);
         }
 
-        public static DemoUser getDemoUser() {
+
+        public static DemoUser getDemoUser () {
             return new DemoUser();
         }
 
-        public static DemoUser getDemoUser(Integer id) {
+
+        public static DemoUser getDemoUser (Integer id) {
             DemoUser demo = new DemoUser();
             demo.setId(id);
             return demo;
         }
 
-        public static boolean isDemo(String username) {
+
+        public static boolean isDemo (String username) {
             return new DemoUser().getUsername().equalsIgnoreCase(username);
         }
 
-        public static ShibUser getShibInstance(String eduPersonID, String mail,
-                String cn) {
+
+        public static ShibUser getShibInstance (String eduPersonID,
+                String mail, String cn) {
             ShibUser u = new ShibUser(eduPersonID);
             u.setAffiliation("");
             u.setMail(mail);
@@ -177,34 +196,32 @@
             return u;
         }
 
-        public static KorAPUser toKorAPUser(Map<String, Object> map) {
-            KorAPUser user = UserFactory
-                    .getUser((String) map.get(Attributes.USERNAME));
+
+        public static KorAPUser toKorAPUser (Map<String, Object> map) {
+            KorAPUser user = UserFactory.getUser((String) map
+                    .get(Attributes.USERNAME));
             user.setPassword((String) map.get(Attributes.PASSWORD));
-            int id = map.get(Attributes.ID) == null ?
-                    -1 :
-                    (int) map.get(Attributes.ID);
+            int id = map.get(Attributes.ID) == null ? -1 : (int) map
+                    .get(Attributes.ID);
             if (id != -1)
                 user.setId(id);
-            long cr = map.get(Attributes.ACCOUNT_CREATION) == null ?
-                    -1 :
-                    (long) map.get(Attributes.ACCOUNT_CREATION);
+            long cr = map.get(Attributes.ACCOUNT_CREATION) == null ? -1
+                    : (long) map.get(Attributes.ACCOUNT_CREATION);
             if (cr != -1)
-                user.setAccountCreation(
-                        (Long) map.get(Attributes.ACCOUNT_CREATION));
+                user.setAccountCreation((Long) map
+                        .get(Attributes.ACCOUNT_CREATION));
             return user;
         }
 
-        public static User toUser(Map<String, Object> map) {
+
+        public static User toUser (Map<String, Object> map) {
             KustvaktMap kmap = new KustvaktMap(map);
-            int type = map.get(Attributes.TYPE) == null ?
-                    0 :
-                    (Integer) kmap.get(Attributes.TYPE, Integer.class);
+            int type = map.get(Attributes.TYPE) == null ? 0 : (Integer) kmap
+                    .get(Attributes.TYPE, Integer.class);
             User user;
             long created = -1;
-            int id = kmap.get(Attributes.ID, Integer.class) == null ?
-                    -1 :
-                    (Integer) kmap.get(Attributes.ID, Integer.class);
+            int id = kmap.get(Attributes.ID, Integer.class) == null ? -1
+                    : (Integer) kmap.get(Attributes.ID, Integer.class);
 
             if (map.get(Attributes.ACCOUNT_CREATION) != null)
                 created = DateTime.parse(kmap.get(Attributes.ACCOUNT_CREATION))
@@ -213,13 +230,11 @@
                 case 0:
                     user = UserFactory.getUser(kmap.get(Attributes.USERNAME));
                     if (id != -1)
-                        user.setId((Integer) kmap
-                                .get(Attributes.ID, Integer.class));
-                    user.setAccountLocked(
-                            map.get(Attributes.ACCOUNTLOCK) == null ?
-                                    false :
-                                    (Boolean) kmap.get(Attributes.ACCOUNTLOCK,
-                                            Boolean.class));
+                        user.setId((Integer) kmap.get(Attributes.ID,
+                                Integer.class));
+                    user.setAccountLocked(map.get(Attributes.ACCOUNTLOCK) == null ? false
+                            : (Boolean) kmap.get(Attributes.ACCOUNTLOCK,
+                                    Boolean.class));
                     user.setAccountCreation(created);
                     break;
                 default:
@@ -229,15 +244,15 @@
             return user;
         }
 
-        public static KorAPUser toUser(String value) {
+
+        public static KorAPUser toUser (String value) {
             JsonNode node = JsonUtils.readTree(value);
-            KorAPUser user = UserFactory
-                    .getUser(node.path(Attributes.USERNAME).asText());
-            user.setAccountLocked(
-                    node.path(Attributes.ACCOUNTLOCK).asBoolean());
+            KorAPUser user = UserFactory.getUser(node.path(Attributes.USERNAME)
+                    .asText());
+            user.setAccountLocked(node.path(Attributes.ACCOUNTLOCK).asBoolean());
             user.setAccountLink(node.path(Attributes.ACCOUNTLINK).asText());
-            user.setAccountCreation(
-                    node.path(Attributes.ACCOUNT_CREATION).asLong());
+            user.setAccountCreation(node.path(Attributes.ACCOUNT_CREATION)
+                    .asLong());
             user.setPassword(node.path(Attributes.PASSWORD).asText());
             return user;
         }
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 47ca9f7..a994eee 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserDetails.java
@@ -3,22 +3,24 @@
 /**
  * @author hanl
  * @date 22/01/2016
- * persistence issue with query request
+ *       persistence issue with query request
  */
 public class UserDetails extends Userdata {
 
-    public UserDetails(Integer userid) {
+    public UserDetails (Integer userid) {
         super(userid);
     }
 
+
     @Override
-    public String[] requiredFields() {
+    public String[] requiredFields () {
         return new String[] { Attributes.EMAIL, Attributes.ADDRESS,
                 Attributes.LASTNAME, Attributes.FIRSTNAME };
     }
 
+
     @Override
-    public String[] defaultFields() {
+    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/user/UserQuery.java b/src/main/java/de/ids_mannheim/korap/user/UserQuery.java
index 0e53aa0..ad48a2d 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserQuery.java
@@ -22,7 +22,8 @@
     private String description;
     private Integer creator;
 
-    public UserQuery(Integer id, int creator) {
+
+    public UserQuery (Integer id, int creator) {
         setId(id);
         setCreator(creator);
         setName("");
@@ -31,34 +32,37 @@
         setQueryLanguage("");
     }
 
-    public UserQuery(String ql, String query, String description) {
+
+    public UserQuery (String ql, String query, String description) {
         setDescription(description);
         setQuery(query);
         setQueryLanguage(ql);
     }
 
-    public UserQuery() {
+
+    public UserQuery () {
         setDescription("");
         setQuery("");
         setQueryLanguage("");
         setName("");
     }
 
-    public void setQuery(String query) {
+
+    public void setQuery (String query) {
         this.query = query;
-        setName("Query: " + query
-                .substring(0, query.length() > 20 ? 20 : query.length()));
+        setName("Query: "
+                + query.substring(0, query.length() > 20 ? 20 : query.length()));
     }
 
+
     // todo: use example queries or store in database
-    public static List<UserQuery> demoUserQueries() {
+    public static List<UserQuery> demoUserQueries () {
 
         List<UserQuery> queries = new ArrayList<>();
         UserQuery q1 = new UserQuery();
         q1.setQueryLanguage("COSMAS2");
         q1.setQuery("$wegen #IN(L) <s>");
-        q1.setDescription(
-                "Findet 'wegen' an Satzanfängen. Berücksichtigt auch Groß- und Kleinschreibung");
+        q1.setDescription("Findet 'wegen' an Satzanfängen. Berücksichtigt auch Groß- und Kleinschreibung");
 
         //todo: change query
         UserQuery q2 = new UserQuery();
@@ -86,11 +90,12 @@
         return queries;
     }
 
+
     //id is irrevelant, since data was coming
     // from frontend and thus this object does not contain a id that could be compared!
     // same with the userAccount. Not set yet!
     @Override
-    public boolean equals(Object o) {
+    public boolean equals (Object o) {
         if (this == o)
             return true;
         if (!(o instanceof UserQuery))
@@ -103,18 +108,19 @@
         return true;
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         int result = getId() != null ? getId().hashCode() : 0;
-        result = 31 * result + (queryLanguage != null ?
-                queryLanguage.hashCode() :
-                0);
+        result = 31 * result
+                + (queryLanguage != null ? queryLanguage.hashCode() : 0);
         result = 31 * result + (query != null ? query.hashCode() : 0);
         return result;
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         final StringBuffer sb = new StringBuffer("UserQuery{");
         sb.append("id=").append(getId());
         //        sb.append(", owner=").append(getOwner());
@@ -125,7 +131,8 @@
         return sb.toString();
     }
 
-    public Map toMap() {
+
+    public Map toMap () {
         Map map = new HashMap();
         map.put("name", this.name);
         map.put("description", this.description);
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 077c869..8eb855a 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserSettings.java
@@ -6,18 +6,20 @@
  */
 public class UserSettings extends Userdata {
 
-    public UserSettings(Integer userid) {
+    public UserSettings (Integer userid) {
         super(userid);
     }
 
+
     @Override
-    public String[] requiredFields() {
+    public String[] requiredFields () {
         return new String[] {};
     }
 
+
     //todo: define default fields and values --> so they can never be null!
     @Override
-    public String[] defaultFields() {
+    public String[] defaultFields () {
         return new String[] { Attributes.DEFAULT_REL_FOUNDRY,
                 Attributes.DEFAULT_POS_FOUNDRY,
                 Attributes.DEFAULT_CONST_FOUNDRY,
diff --git a/src/main/java/de/ids_mannheim/korap/user/Userdata.java b/src/main/java/de/ids_mannheim/korap/user/Userdata.java
index 7b88f00..bb3250d 100644
--- a/src/main/java/de/ids_mannheim/korap/user/Userdata.java
+++ b/src/main/java/de/ids_mannheim/korap/user/Userdata.java
@@ -25,13 +25,15 @@
     @Setter(AccessLevel.PRIVATE)
     private Integer userID;
 
-    public Userdata(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 {
+
+    public void setData (Map<String, Object> map) throws KustvaktException {
         Set missing = missing(map);
         if (!missing.isEmpty())
             throw new KustvaktException(StatusCodes.MISSING_ARGUMENTS,
@@ -40,7 +42,8 @@
         this.fields.putAll(map);
     }
 
-    private Set<String> missing(Map<String, Object> map) {
+
+    private Set<String> missing (Map<String, Object> map) {
         Set<String> missing = new HashSet<>();
         for (String key : requiredFields()) {
             if (!map.containsKey(key))
@@ -49,23 +52,27 @@
         return missing;
     }
 
-    public int size() {
+
+    public int size () {
         return this.fields.size();
     }
 
-    public Object get(String key) {
+
+    public Object get (String key) {
         return this.fields.get(key);
     }
 
+
     /**
-     *
+     * 
      * @return
      */
-    public boolean isValid() {
+    public boolean isValid () {
         return missing().length == 0;
     }
 
-    public String[] missing() {
+
+    public String[] missing () {
         StringBuilder b = new StringBuilder();
         Set<String> m = missing(this.fields);
 
@@ -78,51 +85,61 @@
         return b.toString().split(";");
     }
 
-    public void checkRequired() throws KustvaktException {
+
+    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));
+                    "User data object not valid. Missing fields: "
+                            + Arrays.asList(fields));
         }
     }
 
-    public Set<String> keys() {
+
+    public Set<String> keys () {
         return this.fields.keySet();
     }
 
-    public Collection<Object> values() {
+
+    public Collection<Object> values () {
         return this.fields.values();
     }
 
-    public Map<String, Object> fields() {
+
+    public Map<String, Object> fields () {
         return new HashMap<>(this.fields);
     }
 
-    public void setData(String data) {
+
+    public void setData (String data) {
         Map m = JsonUtils.readSimple(data, Map.class);
         if (m != null)
             this.fields.putAll(m);
     }
 
-    public void update(Userdata other) {
+
+    public void update (Userdata other) {
         if (other != null && this.getClass().equals(other.getClass()))
             this.fields.putAll(other.fields);
     }
 
-    public String data() {
+
+    public String data () {
         return JsonUtils.toJSON(this.fields);
     }
 
-    public void setField(String key, Object value) {
+
+    public void setField (String key, Object value) {
         this.fields.put(key, value);
     }
 
-    public void validate(EncryptionIface crypto) throws KustvaktException {
+
+    public void validate (EncryptionIface crypto) throws KustvaktException {
         this.fields = crypto.validateMap(this.fields);
     }
 
-    public void readDefaults(Map<String, Object> map) throws KustvaktException {
+
+    public void readDefaults (Map<String, Object> map) throws KustvaktException {
         for (String k : defaultFields()) {
             Object o = map.get(k);
             if (o != null)
@@ -131,8 +148,10 @@
         this.checkRequired();
     }
 
-    public abstract String[] requiredFields();
 
-    public abstract String[] defaultFields();
+    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
index 3e899b2..cae83af 100644
--- a/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
+++ b/src/main/java/de/ids_mannheim/korap/user/UserdataFactory.java
@@ -25,10 +25,11 @@
 
     private static final Map<Class<? extends Userdata>, UserDataDbIface> instances = new HashMap<>();
 
-    private UserdataFactory() {
-    }
 
-    public static UserDataDbIface getDaoInstanceFromBean(
+    private UserdataFactory () {}
+
+
+    public static UserDataDbIface getDaoInstanceFromBean (
             Class<? extends Userdata> type) {
         Collection<UserDataDbIface> daos = BeansFactory.getKustvaktContext()
                 .getUserDataDaos();
@@ -44,7 +45,8 @@
         return null;
     }
 
-    public static Class<? extends UserDataDbIface> getClassFromAnno(
+
+    public static Class<? extends UserDataDbIface> getClassFromAnno (
             Class<? extends Userdata> data) {
         Set<Class<? extends UserDataDbIface>> c = KustvaktClassLoader
                 .loadSubTypes(UserDataDbIface.class);
@@ -60,28 +62,32 @@
         return null;
     }
 
+
     // todo: remove and load userdata via bean context
     @Deprecated
-    public static UserDataDbIface getDaoInstance(Class<? extends Userdata> data)
+    public static UserDataDbIface getDaoInstance (Class<? extends Userdata> data)
             throws KustvaktException {
         if (instances.get(data) == null) {
             Class<? extends UserDataDbIface> cl = getClassFromAnno(data);
             if (cl != null) {
                 try {
                     Constructor c = cl.getConstructor(PersistenceClient.class);
-                    UserDataDbIface iface = (UserDataDbIface) c.newInstance(
-                            BeansFactory.getKustvaktContext()
+                    UserDataDbIface iface = (UserDataDbIface) c
+                            .newInstance(BeansFactory.getKustvaktContext()
                                     .getPersistenceClient());
                     instances.put(data, iface);
                     return iface;
-                }catch (NoSuchMethodException | InvocationTargetException | InstantiationException | IllegalAccessException e) {
+                }
+                catch (NoSuchMethodException | InvocationTargetException
+                        | InstantiationException | IllegalAccessException e) {
                     return null;
                 }
             }
             throw new KustvaktException(StatusCodes.NOT_SUPPORTED,
-                    "No database handler found for type " + data
-                            .getSimpleName());
-        }else
+                    "No database handler found for type "
+                            + data.getSimpleName());
+        }
+        else
             return instances.get(data);
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java b/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java
index 02d8cc3..8dbeb4f 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/BooleanUtils.java
@@ -8,13 +8,15 @@
 
     public static String dbname;
 
-    public static Object getBoolean(Object val) {
+
+    public static Object getBoolean (Object val) {
         if (val == null)
             val = false;
         if (dbname != null && dbname.equalsIgnoreCase("sqlite")) {
             if (val instanceof Boolean) {
                 return ((boolean) val) ? 1 : 0;
-            }else if (val instanceof Integer) {
+            }
+            else if (val instanceof Integer) {
                 return ((Integer) val == 1);
             }
         }
diff --git a/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java
index 49f7041..d26d910 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/CollectionQueryBuilder3.java
@@ -9,7 +9,7 @@
 
 /**
  * convenience builder class for collection query
- *
+ * 
  * @author hanl
  * @date 16/09/2014
  */
@@ -23,16 +23,19 @@
     private JsonNode base;
     private StringBuilder builder;
 
-    public CollectionQueryBuilder3() {
+
+    public CollectionQueryBuilder3 () {
         this(false);
     }
 
-    public CollectionQueryBuilder3(boolean verbose) {
+
+    public CollectionQueryBuilder3 (boolean verbose) {
         this.verbose = verbose;
         this.builder = new StringBuilder();
         this.base = null;
     }
 
+
     //    /**
     //     * convencience method for equal field value search operation
     //     * @param field
@@ -56,14 +59,15 @@
     //    }
 
     /**
-     * raw method for field - value pair adding. Supports all operators (leq, geq, contains, etc.)
-     *
+     * raw method for field - value pair adding. Supports all
+     * operators (leq, geq, contains, etc.)
+     * 
      * @param field
      * @param op
      * @param value
      * @return
      */
-    public CollectionQueryBuilder3 fieldValue(String field, String op,
+    public CollectionQueryBuilder3 fieldValue (String field, String op,
             String value) {
         if (base == null)
             this.builder.append(field + op + value);
@@ -74,13 +78,17 @@
         return this;
     }
 
+
     /**
-     * element can be a more complex sub query like (textClass=freizeit & corpusID=WPD)
-     *
-     * @param query will be parenthised in order to make sub query element
+     * element can be a more complex sub query like
+     * (textClass=freizeit & corpusID=WPD)
+     * 
+     * @param query
+     *            will be parenthised in order to make sub query
+     *            element
      * @return
      */
-    public CollectionQueryBuilder3 addQuery(String query) {
+    public CollectionQueryBuilder3 addQuery (String query) {
         if (!query.startsWith("(") && !query.endsWith(")"))
             query = "(" + query + ")";
 
@@ -88,25 +96,29 @@
             CollectionQueryProcessor tree = new CollectionQueryProcessor(
                     this.verbose);
             tree.process(query);
-            JsonNode map = JsonUtils
-                    .valueToTree(tree.getRequestMap().get("collection"));
+            JsonNode map = JsonUtils.valueToTree(tree.getRequestMap().get(
+                    "collection"));
             appendToBaseGroup(map);
-        }else
+        }
+        else
             this.builder.append(query);
         return this;
     }
 
-    public CollectionQueryBuilder3 and() {
+
+    public CollectionQueryBuilder3 and () {
         this.builder.append(" & ");
         return this;
     }
 
-    public CollectionQueryBuilder3 or() {
+
+    public CollectionQueryBuilder3 or () {
         this.builder.append(" | ");
         return this;
     }
 
-    private Object build() {
+
+    private Object build () {
         Object request = base;
         if (request == null) {
             CollectionQueryProcessor tree = new CollectionQueryProcessor(
@@ -120,29 +132,34 @@
         return request;
     }
 
+
     /**
-     * sets base query. All consequent queries are added to the first koral:docGroup within the collection base query
+     * sets base query. All consequent queries are added to the first
+     * koral:docGroup within the collection base query
      * If no group in base query, consequent queries are skipped.
-     *
+     * 
      * @param query
      */
-    public CollectionQueryBuilder3 setBaseQuery(String query) {
+    public CollectionQueryBuilder3 setBaseQuery (String query) {
         this.base = JsonUtils.readTree(query);
         return this;
     }
 
-    public String toJSON() {
+
+    public String toJSON () {
         return JsonUtils.toJSON(build());
     }
 
-    private CollectionQueryBuilder3 appendToBaseGroup(JsonNode node) {
+
+    private CollectionQueryBuilder3 appendToBaseGroup (JsonNode node) {
         if (base.at("/collection/@type").asText().equals("koral:docGroup")) {
             ArrayNode group = (ArrayNode) base.at("/collection/operands");
             if (node instanceof ArrayNode)
                 group.addAll((ArrayNode) node);
             else
                 group.add(node);
-        }else
+        }
+        else
             throw new IllegalArgumentException("No group found to add to!");
         // fixme: if base is a doc only, this function is not supported. requirement is a koral:docGroup, since
         // combination operator is unknown otherwise
@@ -151,7 +168,7 @@
 
     public static class Utils {
 
-        public static JsonNode buildDoc(String key, String value, String op) {
+        public static JsonNode buildDoc (String key, String value, String op) {
             ObjectNode node = JsonUtils.createObjectNode();
             node.put("@type", "koral:doc");
             // eq.equals(EQ.EQUAL) ? "match:eq" : "match:ne"
@@ -162,7 +179,8 @@
             return node;
         }
 
-        public static JsonNode buildDocGroup() {
+
+        public static JsonNode buildDocGroup () {
             ObjectNode node = JsonUtils.createObjectNode();
 
             return node;
diff --git a/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java b/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java
index 2f90f57..6cb0dcd 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/CollectionTypes.java
@@ -15,11 +15,13 @@
 
     private ObjectMapper mapper;
 
-    public CollectionTypes() {
+
+    public CollectionTypes () {
         this.mapper = new ObjectMapper();
     }
 
-    public Map createGroup(String relation, String field, List terms) {
+
+    public Map createGroup (String relation, String field, List terms) {
         if (relation == null)
             return null;
 
@@ -32,7 +34,9 @@
         return kgroup;
     }
 
-    public Map createTerm(String field, String subtype, String value, String type) {
+
+    public Map createTerm (String field, String subtype, String value,
+            String type) {
         Map term = new LinkedHashMap<>();
         if (type == null)
             type = "korap:term";
@@ -45,15 +49,18 @@
         return term;
     }
 
-    public Map createTerm(String field, String value, String type) {
+
+    public Map createTerm (String field, String value, String type) {
         return createTerm(field, null, value, type);
     }
 
-    public Map createTerm(String field, String value) {
+
+    public Map createTerm (String field, String value) {
         return createTerm(field, value, null);
     }
 
-    public Map createResourceFilter(String resource, Map value) {
+
+    public Map createResourceFilter (String resource, Map value) {
         Map meta = new LinkedHashMap();
         meta.put("@type", "korap:meta-filter");
         meta.put("@id", "korap-filter#" + resource);
@@ -61,11 +68,14 @@
         return meta;
     }
 
-    public Map createResourceFilter(String resource, String value) throws IOException {
+
+    public Map createResourceFilter (String resource, String value)
+            throws IOException {
         return createResourceFilter(resource, mapify(value));
     }
 
-    public Map createResourceExtend(String resource, Map value) {
+
+    public Map createResourceExtend (String resource, Map value) {
         Map meta = new LinkedHashMap();
         meta.put("@type", "korap:meta-extend");
         meta.put("@id", "korap-filter#" + resource);
@@ -73,14 +83,16 @@
         return meta;
     }
 
-    public Map createMetaFilter(Map value) {
+
+    public Map createMetaFilter (Map value) {
         Map meta = new LinkedHashMap();
         meta.put("@type", "korap:meta-filter");
         meta.put("@value", value);
         return meta;
     }
 
-    public Map createMetaExtend(Map value) {
+
+    public Map createMetaExtend (Map value) {
         Map meta = new LinkedHashMap();
         meta.put("@type", "korap:meta-extend");
         meta.put("@value", value);
@@ -88,7 +100,7 @@
     }
 
 
-    public Map mapify(String s) throws IOException {
+    public Map mapify (String s) throws IOException {
         return mapper.readValue(s, Map.class);
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java b/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java
index 5bb811e..ea02e44 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/ConcurrentMultiMap.java
@@ -32,21 +32,27 @@
     private final LockMap<K> locks;
     private final ConcurrentMap<K, List<V>> cache;
 
-    public ConcurrentMultiMap() {
+
+    public ConcurrentMultiMap () {
         this(16, 64);
     }
 
-    public ConcurrentMultiMap(final int concurrencyLevel) {
+
+    public ConcurrentMultiMap (final int concurrencyLevel) {
         this(concurrencyLevel, 64);
     }
 
-    public ConcurrentMultiMap(final int concurrencyLevel, final int initialCapacity) {
+
+    public ConcurrentMultiMap (final int concurrencyLevel,
+                               final int initialCapacity) {
         this.initialCapacity = initialCapacity;
-        cache = new MapMaker().concurrencyLevel(concurrencyLevel).initialCapacity(initialCapacity).makeMap();
+        cache = new MapMaker().concurrencyLevel(concurrencyLevel)
+                .initialCapacity(initialCapacity).makeMap();
         locks = new LockMap<K>(concurrencyLevel, initialCapacity);
     }
 
-    public void put(final K key, final V value) {
+
+    public void put (final K key, final V value) {
         synchronized (locks.getLock(key)) {
             List<V> set = cache.get(key);
             if (set == null) {
@@ -57,7 +63,8 @@
         }
     }
 
-    public void putAll(final K key, final Collection<V> values) {
+
+    public void putAll (final K key, final Collection<V> values) {
         synchronized (locks.getLock(key)) {
             List<V> set = cache.get(key);
             if (set == null) {
@@ -68,14 +75,15 @@
         }
     }
 
-    public List<V> remove(final K key) {
+
+    public List<V> remove (final K key) {
         synchronized (locks.getLock(key)) {
             return cache.remove(key);
         }
     }
 
 
-    public void remove(final K key, final V value) {
+    public void remove (final K key, final V value) {
         List<V> values = cache.get(key);
         synchronized (locks.getLock(key)) {
             values.remove(value);
@@ -83,19 +91,22 @@
     }
 
 
-    public Set<K> getKeySet() {
+    public Set<K> getKeySet () {
         return cache.keySet();
     }
 
-    public int size() {
+
+    public int size () {
         return cache.size();
     }
 
-    public boolean containsKey(K key) {
+
+    public boolean containsKey (K key) {
         return cache.containsKey(key);
     }
 
-    public List<V> get(K key) {
+
+    public List<V> get (K key) {
         return cache.get(key);
     }
 
@@ -103,19 +114,24 @@
     public class LockMap<K extends Comparable> {
         private final ConcurrentMap<K, Object> locks;
 
-        public LockMap() {
+
+        public LockMap () {
             this(16, 64);
         }
 
-        public LockMap(final int concurrencyLevel) {
+
+        public LockMap (final int concurrencyLevel) {
             this(concurrencyLevel, 64);
         }
 
-        public LockMap(final int concurrencyLevel, final int initialCapacity) {
-            locks = new MapMaker().concurrencyLevel(concurrencyLevel).initialCapacity(initialCapacity).weakValues().makeMap();
+
+        public LockMap (final int concurrencyLevel, final int initialCapacity) {
+            locks = new MapMaker().concurrencyLevel(concurrencyLevel)
+                    .initialCapacity(initialCapacity).weakValues().makeMap();
         }
 
-        public Object getLock(final K key) {
+
+        public Object getLock (final K key) {
             final Object object = new Object();
             Object lock = locks.putIfAbsent(key, object);
             return lock == null ? object : lock;
@@ -124,7 +140,7 @@
     }
 
 
-    public String toString() {
+    public String toString () {
         return cache.toString();
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java b/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java
index 58e1ae7..c2511a7 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/IPNetMask.java
@@ -8,9 +8,9 @@
  * User: hanl
  * Date: 9/13/13
  * Time: 2:25 PM
- *
+ * 
  * currently only supports IPv4!
- *
+ * 
  */
 // todo: integrate to gerrit
 public class IPNetMask {
@@ -23,7 +23,8 @@
 
     private static final int default_mask = 16;
 
-    private IPNetMask(Inet4Address i4addr, byte mask) {
+
+    private IPNetMask (Inet4Address i4addr, byte mask) {
         this.i4addr = i4addr;
         this.maskCtr = mask;
 
@@ -31,16 +32,20 @@
         this.maskInt = ~((1 << (32 - maskCtr)) - 1);
     }
 
+
     /**
      * IPNetMask factory method.
-     *
-     * @param addrSlashMask IP/Mask String in format "nnn.nnn.nnn.nnn/mask". If
-     *                      the "/mask" is omitted, "/32" (just the single address) is assumed.
+     * 
+     * @param addrSlashMask
+     *            IP/Mask String in format "nnn.nnn.nnn.nnn/mask". If
+     *            the "/mask" is omitted, "/32" (just the single
+     *            address) is assumed.
      * @return a new IPNetMask
-     * @throws UnknownHostException if address part cannot be parsed by
-     *                              InetAddress
+     * @throws UnknownHostException
+     *             if address part cannot be parsed by
+     *             InetAddress
      */
-    public static IPNetMask getIPMask(String addrSlashMask)
+    public static IPNetMask getIPMask (String addrSlashMask)
             throws UnknownHostException {
         int pos = addrSlashMask.indexOf('/');
         String addr;
@@ -48,55 +53,63 @@
         if (pos == -1) {
             addr = addrSlashMask;
             maskCtr = default_mask;
-        } else {
+        }
+        else {
             addr = addrSlashMask.substring(0, pos);
             maskCtr = Byte.parseByte(addrSlashMask.substring(pos + 1));
         }
 
-        return new IPNetMask((Inet4Address) InetAddress.getByName(addr), maskCtr);
+        return new IPNetMask((Inet4Address) InetAddress.getByName(addr),
+                maskCtr);
     }
 
+
     /**
      * Test given IPv4 address against this IPNetMask object.
-     *
-     * @param testAddr address to isSystem.
+     * 
+     * @param testAddr
+     *            address to isSystem.
      * @return true if address is in the IP Mask range, false if not.
      */
-    public boolean matches(Inet4Address testAddr) {
+    public boolean matches (Inet4Address testAddr) {
         int testAddrInt = addrToInt(testAddr);
         return ((addrInt & maskInt) == (testAddrInt & maskInt));
     }
 
+
     /**
      * Convenience method that converts String host to IPv4 address.
-     *
-     * @param addr IP address to match in nnn.nnn.nnn.nnn format or hostname.
+     * 
+     * @param addr
+     *            IP address to match in nnn.nnn.nnn.nnn format or
+     *            hostname.
      * @return true if address is in the IP Mask range, false if not.
-     * @throws UnknownHostException if the string cannot be decoded.
+     * @throws UnknownHostException
+     *             if the string cannot be decoded.
      */
-    public boolean matches(String addr)
-            throws UnknownHostException {
+    public boolean matches (String addr) throws UnknownHostException {
         return matches((Inet4Address) InetAddress.getByName(addr));
     }
 
+
     /**
      * Converts IPv4 address to integer representation.
      */
-    private int addrToInt(Inet4Address i4addr) {
+    private int addrToInt (Inet4Address i4addr) {
         byte[] ba = i4addr.getAddress();
-        return (ba[0] << 24)
-                | ((ba[1] & 0xFF) << 16)
-                | ((ba[2] & 0xFF) << 8)
+        return (ba[0] << 24) | ((ba[1] & 0xFF) << 16) | ((ba[2] & 0xFF) << 8)
                 | (ba[3] & 0xFF);
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         return i4addr.getHostAddress() + "/" + maskCtr;
     }
 
+
     @Override
-    public boolean equals(Object obj) {
+    public boolean equals (Object obj) {
         if (obj == null)
             return false;
         if (getClass() != obj.getClass())
@@ -105,8 +118,9 @@
         return (this.addrInt == that.addrInt && this.maskInt == that.maskInt);
     }
 
+
     @Override
-    public int hashCode() {
+    public int hashCode () {
         return this.maskInt + this.addrInt;
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java b/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
index 85c7e3e..84537a5 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/JsonUtils.java
@@ -20,70 +20,85 @@
 public class JsonUtils {
     private static ObjectMapper mapper = new ObjectMapper();
 
-    private JsonUtils() {
-    }
 
-    public static String toJSON(Object values) {
+    private JsonUtils () {}
+
+
+    public static String toJSON (Object values) {
         try {
             return mapper.writeValueAsString(values);
-        }catch (JsonProcessingException e) {
+        }
+        catch (JsonProcessingException e) {
             return "";
         }
     }
 
-    public static JsonNode readTree(String s) {
+
+    public static JsonNode readTree (String s) {
         try {
             return mapper.readTree(s);
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             return null;
         }
     }
 
-    public static ObjectNode createObjectNode() {
+
+    public static ObjectNode createObjectNode () {
         return mapper.createObjectNode();
     }
 
-    public static ArrayNode createArrayNode() {
+
+    public static ArrayNode createArrayNode () {
         return mapper.createArrayNode();
     }
 
-    public static JsonNode valueToTree(Object value) {
+
+    public static JsonNode valueToTree (Object value) {
         return mapper.valueToTree(value);
     }
 
-    public static <T> T read(String json, Class<T> cl) throws IOException {
+
+    public static <T> T read (String json, Class<T> cl) throws IOException {
         return mapper.readValue(json, cl);
     }
 
-    public static <T> T readFile(String path, Class<T> clazz)
+
+    public static <T> T readFile (String path, Class<T> clazz)
             throws IOException {
         return mapper.readValue(new File(path), clazz);
     }
 
-    public static void writeFile(String path, String content) throws IOException {
+
+    public static void writeFile (String path, String content)
+            throws IOException {
         mapper.writeValue(new File(path), content);
     }
 
-    public static <T> T readSimple(String json, Class<T> cl) {
+
+    public static <T> T readSimple (String json, Class<T> cl) {
         try {
             return mapper.readValue(json, cl);
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             return null;
         }
     }
 
-    public static List<Map<String, Object>> convertToList(String json)
+
+    public static List<Map<String, Object>> convertToList (String json)
             throws JsonProcessingException {
         List d = new ArrayList();
         JsonNode node = JsonUtils.readTree(json);
         if (node.isArray()) {
             Iterator<JsonNode> nodes = node.iterator();
             while (nodes.hasNext()) {
-                Map<String, Object> map = mapper
-                        .treeToValue(nodes.next(), Map.class);
+                Map<String, Object> map = mapper.treeToValue(nodes.next(),
+                        Map.class);
                 d.add(map);
             }
-        }else if (node.isObject()) {
+        }
+        else if (node.isObject()) {
             Map<String, Object> map = mapper.treeToValue(node, Map.class);
             d.add(map);
         }
diff --git a/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java b/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java
index cb7a976..e75db81 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/KustvaktLogger.java
@@ -17,357 +17,415 @@
     public static final String ERROR_LOG = "errorLog";
     public static final String SECURITY_LOG = "securityLog";
 
-    //fixme:
-    public static final KustvaktLogger ERROR_LOGGER = KustvaktLogger
-            .getLogger(ERROR_LOG);
     public static final KustvaktLogger QUERY_LOGGER = KustvaktLogger
             .getLogger("ql");
 
-    @Deprecated
-    public static final KustvaktLogger SECURITY_LOGGER = KustvaktLogger
-            .getLogger("security");
     private Logger log;
 
-    public static KustvaktLogger getLogger(Class cl) {
+
+    public static KustvaktLogger getLogger (Class cl) {
         return new KustvaktLogger(LoggerFactory.getLogger(cl));
     }
 
-    public static KustvaktLogger getLogger(String name) {
+
+    public static KustvaktLogger getLogger (String name) {
         return new KustvaktLogger(LoggerFactory.getLogger(name));
 
     }
 
-    private KustvaktLogger(Logger log) {
+
+    private KustvaktLogger (Logger log) {
         this.log = log;
     }
 
+
     @Override
-    public String getName() {
+    public String getName () {
         return log.getName();
     }
 
+
     @Override
-    public boolean isTraceEnabled() {
+    public boolean isTraceEnabled () {
         return log.isTraceEnabled();
     }
 
+
     @Override
-    public void trace(String s) {
+    public void trace (String s) {
         if (DEBUG)
             this.log.trace(s);
 
     }
 
+
     @Override
-    public void trace(String s, Object o) {
+    public void trace (String s, Object o) {
         if (DEBUG)
             this.log.trace(s, o);
     }
 
+
     @Override
-    public void trace(String s, Object o, Object o2) {
+    public void trace (String s, Object o, Object o2) {
         if (DEBUG)
             this.log.trace(s, o, o2);
     }
 
+
     @Override
-    public void trace(String s, Object... objects) {
+    public void trace (String s, Object ... objects) {
         if (DEBUG)
             this.log.trace(s, objects);
     }
 
+
     @Override
-    public void trace(String s, Throwable throwable) {
+    public void trace (String s, Throwable throwable) {
         if (DEBUG)
             this.log.trace(s, throwable);
     }
 
+
     @Override
-    public boolean isTraceEnabled(Marker marker) {
+    public boolean isTraceEnabled (Marker marker) {
         if (DEBUG)
             return this.log.isTraceEnabled();
         return false;
     }
 
+
     @Override
-    public void trace(Marker marker, String s) {
+    public void trace (Marker marker, String s) {
         if (DEBUG)
             this.log.trace(marker, s);
     }
 
+
     @Override
-    public void trace(Marker marker, String s, Object o) {
+    public void trace (Marker marker, String s, Object o) {
         if (DEBUG)
             this.log.trace(marker, s, o);
     }
 
+
     @Override
-    public void trace(Marker marker, String s, Object o, Object o2) {
+    public void trace (Marker marker, String s, Object o, Object o2) {
         if (DEBUG)
             this.log.trace(marker, s, o, o2);
     }
 
+
     @Override
-    public void trace(Marker marker, String s, Object... objects) {
+    public void trace (Marker marker, String s, Object ... objects) {
         if (DEBUG)
             this.log.trace(marker, s, objects);
     }
 
+
     @Override
-    public void trace(Marker marker, String s, Throwable throwable) {
+    public void trace (Marker marker, String s, Throwable throwable) {
         if (DEBUG)
             this.log.trace(marker, s, throwable);
     }
 
+
     @Override
-    public boolean isDebugEnabled() {
+    public boolean isDebugEnabled () {
         if (DEBUG)
             return true;
         return false;
     }
 
+
     @Override
-    public void debug(String s) {
+    public void debug (String s) {
         if (DEBUG)
             this.log.debug(s);
     }
 
+
     @Override
-    public void debug(String s, Object o) {
+    public void debug (String s, Object o) {
         if (DEBUG)
             this.log.debug(s, o);
     }
 
+
     @Override
-    public void debug(String s, Object o, Object o2) {
+    public void debug (String s, Object o, Object o2) {
         if (DEBUG)
             this.log.debug(s, o, o2);
     }
 
+
     @Override
-    public void debug(String s, Object... objects) {
+    public void debug (String s, Object ... objects) {
         if (DEBUG)
             this.log.debug(s);
     }
 
+
     @Override
-    public void debug(String s, Throwable throwable) {
+    public void debug (String s, Throwable throwable) {
         if (DEBUG)
             this.log.debug(s, throwable);
     }
 
+
     @Override
-    public boolean isDebugEnabled(Marker marker) {
+    public boolean isDebugEnabled (Marker marker) {
         return this.log.isDebugEnabled(marker);
     }
 
+
     @Override
-    public void debug(Marker marker, String s) {
+    public void debug (Marker marker, String s) {
         if (DEBUG)
             this.log.debug(marker, s);
     }
 
+
     @Override
-    public void debug(Marker marker, String s, Object o) {
+    public void debug (Marker marker, String s, Object o) {
         if (DEBUG)
             this.log.debug(marker, s, o);
     }
 
+
     @Override
-    public void debug(Marker marker, String s, Object o, Object o2) {
+    public void debug (Marker marker, String s, Object o, Object o2) {
         if (DEBUG)
             this.log.debug(marker, s, o, o2);
     }
 
+
     @Override
-    public void debug(Marker marker, String s, Object... objects) {
+    public void debug (Marker marker, String s, Object ... objects) {
         if (DEBUG)
             this.log.debug(marker, s, objects);
     }
 
+
     @Override
-    public void debug(Marker marker, String s, Throwable throwable) {
+    public void debug (Marker marker, String s, Throwable throwable) {
         if (DEBUG)
             this.log.debug(marker, s, throwable);
     }
 
+
     @Override
-    public boolean isInfoEnabled() {
+    public boolean isInfoEnabled () {
         return this.log.isInfoEnabled();
     }
 
+
     @Override
-    public void info(String s) {
+    public void info (String s) {
         this.log.info(s);
     }
 
+
     @Override
-    public void info(String s, Object o) {
+    public void info (String s, Object o) {
         this.log.info(s, o);
     }
 
+
     @Override
-    public void info(String s, Object o, Object o2) {
+    public void info (String s, Object o, Object o2) {
         this.log.info(s, o, o2);
     }
 
+
     @Override
-    public void info(String s, Object... objects) {
+    public void info (String s, Object ... objects) {
         this.log.info(s, objects);
     }
 
+
     @Override
-    public void info(String s, Throwable throwable) {
+    public void info (String s, Throwable throwable) {
         this.log.info(s, throwable);
     }
 
+
     @Override
-    public boolean isInfoEnabled(Marker marker) {
+    public boolean isInfoEnabled (Marker marker) {
         return this.log.isInfoEnabled(marker);
     }
 
+
     @Override
-    public void info(Marker marker, String s) {
+    public void info (Marker marker, String s) {
         this.log.info(marker, s);
     }
 
+
     @Override
-    public void info(Marker marker, String s, Object o) {
+    public void info (Marker marker, String s, Object o) {
         this.log.info(marker, s, o);
     }
 
+
     @Override
-    public void info(Marker marker, String s, Object o, Object o2) {
+    public void info (Marker marker, String s, Object o, Object o2) {
         this.log.info(marker, s, o, o2);
     }
 
+
     @Override
-    public void info(Marker marker, String s, Object... objects) {
+    public void info (Marker marker, String s, Object ... objects) {
         this.log.info(marker, s, objects);
     }
 
+
     @Override
-    public void info(Marker marker, String s, Throwable throwable) {
+    public void info (Marker marker, String s, Throwable throwable) {
         this.log.info(marker, s, throwable);
     }
 
+
     @Override
-    public boolean isWarnEnabled() {
+    public boolean isWarnEnabled () {
         return this.log.isWarnEnabled();
     }
 
+
     @Override
-    public void warn(String s) {
+    public void warn (String s) {
         this.log.warn(s);
     }
 
+
     @Override
-    public void warn(String s, Object o) {
+    public void warn (String s, Object o) {
         this.log.warn(s, o);
     }
 
+
     @Override
-    public void warn(String s, Object... objects) {
+    public void warn (String s, Object ... objects) {
         this.log.warn(s, objects);
     }
 
+
     @Override
-    public void warn(String s, Object o, Object o2) {
+    public void warn (String s, Object o, Object o2) {
         this.log.warn(s, o, o2);
     }
 
+
     @Override
-    public void warn(String s, Throwable throwable) {
+    public void warn (String s, Throwable throwable) {
         this.log.warn(s, throwable);
     }
 
+
     @Override
-    public boolean isWarnEnabled(Marker marker) {
+    public boolean isWarnEnabled (Marker marker) {
         return this.log.isTraceEnabled(marker);
     }
 
+
     @Override
-    public void warn(Marker marker, String s) {
+    public void warn (Marker marker, String s) {
         this.log.warn(marker, s);
     }
 
+
     @Override
-    public void warn(Marker marker, String s, Object o) {
+    public void warn (Marker marker, String s, Object o) {
         this.log.warn(marker, s, o);
     }
 
+
     @Override
-    public void warn(Marker marker, String s, Object o, Object o2) {
+    public void warn (Marker marker, String s, Object o, Object o2) {
         this.log.warn(marker, s, o, o2);
     }
 
+
     @Override
-    public void warn(Marker marker, String s, Object... objects) {
+    public void warn (Marker marker, String s, Object ... objects) {
         this.log.warn(marker, s, objects);
     }
 
+
     @Override
-    public void warn(Marker marker, String s, Throwable throwable) {
+    public void warn (Marker marker, String s, Throwable throwable) {
         this.log.warn(marker, s, throwable);
     }
 
+
     @Override
-    public boolean isErrorEnabled() {
+    public boolean isErrorEnabled () {
         return this.log.isErrorEnabled();
     }
 
+
     @Override
-    public void error(String s) {
+    public void error (String s) {
         this.log.error(s);
     }
 
+
     @Override
-    public void error(String s, Object o) {
+    public void error (String s, Object o) {
         this.log.error(s, o);
     }
 
+
     @Override
-    public void error(String s, Object o, Object o2) {
+    public void error (String s, Object o, Object o2) {
         this.log.error(s, o, o2);
     }
 
+
     @Override
-    public void error(String s, Object... objects) {
+    public void error (String s, Object ... objects) {
         this.log.error(s, objects);
     }
 
+
     @Override
-    public void error(String s, Throwable throwable) {
+    public void error (String s, Throwable throwable) {
         this.log.error(s, throwable);
     }
 
+
     @Override
-    public boolean isErrorEnabled(Marker marker) {
+    public boolean isErrorEnabled (Marker marker) {
         return this.log.isErrorEnabled(marker);
     }
 
+
     @Override
-    public void error(Marker marker, String s) {
+    public void error (Marker marker, String s) {
         this.log.error(marker, s);
     }
 
+
     @Override
-    public void error(Marker marker, String s, Object o) {
+    public void error (Marker marker, String s, Object o) {
         this.log.error(marker, s, o);
     }
 
+
     @Override
-    public void error(Marker marker, String s, Object o, Object o2) {
+    public void error (Marker marker, String s, Object o, Object o2) {
         this.log.error(marker, s, o, o2);
     }
 
+
     @Override
-    public void error(Marker marker, String s, Object... objects) {
+    public void error (Marker marker, String s, Object ... objects) {
         this.log.error(marker, s, objects);
     }
 
+
     @Override
-    public void error(Marker marker, String s, Throwable throwable) {
+    public void error (Marker marker, String s, Throwable throwable) {
         this.log.error(marker, s, throwable);
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java b/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java
index b07df0d..20e94d5 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/PrefixTreeMap.java
@@ -10,7 +10,7 @@
 public class PrefixTreeMap<V> extends TreeMap<String, V> {
 
 
-    public SortedMap<String, V> getPrefixSubMap(String prefix) {
+    public SortedMap<String, V> getPrefixSubMap (String prefix) {
         if (prefix != null && prefix.length() > 0) {
             SortedMap d = this.subMap(prefix, getEnd(prefix));
             if (d.isEmpty())
@@ -20,13 +20,15 @@
         return null;
     }
 
-    private String getEnd(String prefix) {
+
+    private String getEnd (String prefix) {
         char nextLetter = (char) (prefix.charAt(prefix.length() - 1) + 1);
         return prefix.substring(0, prefix.length() - 1) + nextLetter;
 
     }
 
-    public V getFirstValue(String prefix) {
+
+    public V getFirstValue (String prefix) {
         if (prefix.length() > 0) {
             String first = this.subMap(prefix, getEnd(prefix)).firstKey();
             return this.get(first);
@@ -34,7 +36,8 @@
         return null;
     }
 
-    public V getLastValue(String prefix) {
+
+    public V getLastValue (String prefix) {
         if (prefix.length() > 0) {
             String last = this.subMap(prefix, getEnd(prefix)).lastKey();
             return this.get(last);
diff --git a/src/main/java/de/ids_mannheim/korap/utils/PropertyReader.java b/src/main/java/de/ids_mannheim/korap/utils/PropertyReader.java
index 9d953b5..0b16cc0 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/PropertyReader.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/PropertyReader.java
@@ -15,7 +15,7 @@
  */
 public abstract class PropertyReader {
 
-    protected Map<String, Properties> read(String path) throws IOException {
+    protected Map<String, Properties> read (String path) throws IOException {
         Map<String, Properties> res = new HashMap<>();
         Properties s = new Properties();
         s.load(new FileInputStream(new File(path)));
@@ -31,6 +31,7 @@
         return res;
     }
 
-    public abstract void load();
+
+    public abstract void load ();
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java b/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java
index d3b5028..fa1314b 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/SqlBuilder.java
@@ -11,12 +11,14 @@
     private String[] fields;
     private String where;
 
-    public SqlBuilder(String table) {
+
+    public SqlBuilder (String table) {
         this.buffer = new StringBuffer();
         this.table = table;
     }
 
-    public SqlBuilder select(String... fields) {
+
+    public SqlBuilder select (String ... fields) {
         this.buffer.append("SELECT ");
         if (fields.length > 0) {
             for (int i = 0; i < fields.length; i++) {
@@ -24,30 +26,35 @@
                     this.buffer.append(", ");
                 this.buffer.append(fields[i]);
             }
-        }else
+        }
+        else
             this.buffer.append("*");
         this.buffer.append(" FROM ").append(table);
         return this;
     }
 
-    public SqlBuilder update(String... fields) {
+
+    public SqlBuilder update (String ... fields) {
         this.buffer.append("UPDATE ").append(table);
         this.fields = fields;
         return this;
     }
 
-    public SqlBuilder insert(String... fields) {
+
+    public SqlBuilder insert (String ... fields) {
         this.buffer.append("INSERT INTO ").append(table);
         this.fields = fields;
         return this;
     }
 
-    public SqlBuilder delete() {
+
+    public SqlBuilder delete () {
         this.buffer.append("DELETE FROM ").append(table);
         return this;
     }
 
-    public SqlBuilder params(String... values) {
+
+    public SqlBuilder params (String ... values) {
         if (values.length != fields.length)
             return this;
         if (this.buffer.lastIndexOf("INSERT INTO") != -1) {
@@ -77,13 +84,15 @@
         return this;
     }
 
-    public SqlBuilder where(String where) {
+
+    public SqlBuilder where (String where) {
         this.where = where;
         return this;
     }
 
+
     @Override
-    public String toString() {
+    public String toString () {
         StringBuffer b = new StringBuffer(this.buffer);
         //exclude where clauses from insert statements
         if (this.where != null && this.buffer.lastIndexOf("INSERT INTO") == -1)
diff --git a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
index 56e3c3d..7cd7b56 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/StringUtils.java
@@ -10,10 +10,10 @@
     private final static Logger jlog = LoggerFactory
             .getLogger(StringUtils.class);
 
-    private static final String SLASH = "/";
     private static final String SEP = ";";
 
-    public static Collection<UUID> stringToUUIDList(String s) {
+
+    public static Collection<UUID> stringToUUIDList (String s) {
         String[] array = s.split(SEP);
         List<UUID> list = new LinkedList<>();
         for (String att : array) {
@@ -22,7 +22,8 @@
         return list;
     }
 
-    public static List<String> toList(String values) {
+
+    public static List<String> toList (String values) {
         List<String> list = new ArrayList<>();
         StringTokenizer tokenizer = new StringTokenizer(values, SEP);
         while (tokenizer.hasMoreTokens())
@@ -30,7 +31,8 @@
         return list;
     }
 
-    public static Set<String> toSet(String values, String sep) {
+
+    public static Set<String> toSet (String values, String sep) {
         Set<String> set = new HashSet<>();
         if (values != null && !values.isEmpty()) {
             StringTokenizer tokenizer = new StringTokenizer(values, sep);
@@ -40,15 +42,18 @@
         return set;
     }
 
-    public static Set<String> toSet(String values) {
+
+    public static Set<String> toSet (String values) {
         return toSet(values, SEP);
     }
 
-    public static String toString(Collection<String> values) {
+
+    public static String toString (Collection<String> values) {
         return StringUtils.toString(values, SEP);
     }
 
-    public static String toString(Collection<String> values, String sep) {
+
+    public static String toString (Collection<String> values, String sep) {
         StringBuffer b = new StringBuffer();
         for (String s : values)
             b.append(s).append(sep);
@@ -58,12 +63,14 @@
         return b.toString();
     }
 
-    public static String orderedToString(Collection<String> hash) {
+
+    public static String orderedToString (Collection<String> hash) {
         Set<String> orderedSet = new TreeSet<>();
         orderedSet.addAll(hash);
         if (orderedSet.isEmpty()) {
             return "";
-        }else {
+        }
+        else {
             StringBuilder builder = new StringBuilder();
             for (String s : orderedSet) {
                 builder.append(s);
@@ -74,12 +81,14 @@
         }
     }
 
-    public static String UUIDsetToString(Collection<UUID> hash) {
+
+    public static String UUIDsetToString (Collection<UUID> hash) {
         Set<UUID> orderedSet = new TreeSet<>();
         orderedSet.addAll(hash);
         if (orderedSet.isEmpty()) {
             return "";
-        }else {
+        }
+        else {
             StringBuilder builder = new StringBuilder();
             for (UUID s : orderedSet) {
                 builder.append(s);
@@ -90,7 +99,8 @@
         }
     }
 
-    public static String buildSQLRegex(String path) {
+
+    public static String buildSQLRegex (String path) {
         StringBuilder b = new StringBuilder();
         String[] match = path.split("/");
         b.append(match[0]);
@@ -99,87 +109,49 @@
         return b.toString();
     }
 
-    public static Collection<String> joinStringSet(Collection<String> source,
-            String other) {
-        Set<String> set = new HashSet<>(source);
-        set.add(other);
-        return set;
-    }
 
-    public static Collection<UUID> joinUUIDSet(Collection<UUID> source,
-            UUID other) {
-        Set<UUID> set = new HashSet<>(source);
-        set.add(other);
-        return set;
-    }
-
-    public static String joinResources(String first, String second) {
-        String res;
-        if (first != null && !first.isEmpty())
-            res = first + SLASH + second;
-        else
-            res = second;
-        return res.replaceAll("\\s", "");
-    }
-
-    public static String[] splitAnnotations(String joined) {
-        String[] spl = joined.split(SLASH);
-        if (spl.length == 2)
-            return spl;
-        else
-            return null;
-    }
-
-    public static String stripTokenType(String token) {
-        int idx = token.lastIndexOf(" ");
-        if (idx == -1)
-            return token;
-        return token.substring(idx).replaceAll("\\s", "");
-    }
-
-    public static String getTokenType(String token) {
-        if (token.contains(" "))
-            return token.substring(0, token.lastIndexOf(" "))
-                    .replaceAll("\\s", "").toLowerCase();
-        else
-            return null;
-    }
-
-    public static boolean isInteger(String value) {
+    public static boolean isInteger (String value) {
         try {
             Integer.valueOf(value);
             return true;
-        }catch (IllegalArgumentException e) {
+        }
+        catch (IllegalArgumentException e) {
             // do nothing!
             return false;
         }
     }
 
-    public static String normalize(String value) {
+
+    public static String normalize (String value) {
         return value.trim().toLowerCase();
     }
 
-    public static String normalizeHTML(String value) {
+
+    public static String normalizeHTML (String value) {
         return StringEscapeUtils.escapeHtml(value);
     }
 
-    public static String decodeHTML(String value) {
+
+    public static String decodeHTML (String value) {
         return StringEscapeUtils.unescapeHtml(value);
     }
 
+
     /**
-     * constructs a lucene query from query string and corpus parameters as set
-     *
+     * constructs a lucene query from query string and corpus
+     * parameters as set
+     * 
      * @param query
      * @param corpusIDs
      * @return
      */
-    public static String queryBuilder(String query,
+    public static String queryBuilder (String query,
             Collection<String> corpusIDs) {
         String completeQuery; // holds original query and corpus
         // selection
         /**
-         * find documents with metadataquery TODO: does not intercept with
+         * find documents with metadataquery TODO: does not intercept
+         * with
          * parameters foundries and corpusIDs
          */
 
diff --git a/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java b/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
index 1da1fdc..e632c50 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/TimeUtils.java
@@ -18,7 +18,8 @@
 /**
  * @author hanl
  *         <p/>
- *         calculates current, expiration and inactive time for security
+ *         calculates current, expiration and inactive time for
+ *         security
  *         purposes.
  * @return
  */
@@ -28,7 +29,8 @@
     private static final DateTimeZone dtz = DateTimeZone.forID("Europe/Berlin");
     private static Logger jlog = LoggerFactory.getLogger(TimeUtils.class);
 
-    public static int convertTimeToSeconds(String expirationVal) {
+
+    public static int convertTimeToSeconds (String expirationVal) {
         expirationVal = expirationVal.trim();
         int finIndex = expirationVal.length() - 1;
         char entity = expirationVal.charAt(finIndex);
@@ -45,36 +47,40 @@
             case 'S':
                 return returnSec;
             default:
-                jlog.debug(
-                        "no time unit specified. Trying to read from default (minutes)");
+                jlog.debug("no time unit specified. Trying to read from default (minutes)");
                 return Integer.valueOf(expirationVal) * 60;
         }
 
     }
 
+
     //todo: time zone is wrong!
-    public static DateTime getNow() {
+    public static DateTime getNow () {
         return DateTime.now().withZone(dtz);
     }
 
+
     //returns difference in milliseconds
-    public static long calcDiff(DateTime now, DateTime future) {
+    public static long calcDiff (DateTime now, DateTime future) {
         long diff = (future.withZone(dtz).getMillis() - now.withZone(dtz)
                 .getMillis());
         return diff;
     }
 
-    public static boolean isPassed(long time) {
+
+    public static boolean isPassed (long time) {
         return getNow().isAfter(time);
 
     }
 
-    public static boolean isPassed(DateTime time) {
+
+    public static boolean isPassed (DateTime time) {
         return isPassed(time.getMillis());
     }
 
+
     // returns difference in seconds in floating number
-    public static float floating(DateTime past, DateTime now) {
+    public static float floating (DateTime past, DateTime now) {
         long diff = (now.withZone(dtz).getMillis() - past.withZone(dtz)
                 .getMillis());
         double fin = diff / 1000.0;
@@ -82,104 +88,120 @@
         return bd.floatValue();
     }
 
-    public static DateTime fromCosmas(String date) {
+
+    public static DateTime fromCosmas (String date) {
         int idx = date.length();
         try {
-            Integer sec = Integer.valueOf(
-                    date.substring((idx = idx - 2), date.length()).trim());
-            Integer min = Integer
-                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
-            Integer hours = Integer
-                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
-            Integer day = Integer
-                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
-            Integer month = Integer
-                    .valueOf(date.substring((idx = idx - 2), idx + 2).trim());
-            Integer year = Integer
-                    .valueOf(date.substring((idx = idx - 4), idx + 4).trim());
+            Integer sec = Integer.valueOf(date.substring((idx = idx - 2),
+                    date.length()).trim());
+            Integer min = Integer.valueOf(date.substring((idx = idx - 2),
+                    idx + 2).trim());
+            Integer hours = Integer.valueOf(date.substring((idx = idx - 2),
+                    idx + 2).trim());
+            Integer day = Integer.valueOf(date.substring((idx = idx - 2),
+                    idx + 2).trim());
+            Integer month = Integer.valueOf(date.substring((idx = idx - 2),
+                    idx + 2).trim());
+            Integer year = Integer.valueOf(date.substring((idx = idx - 4),
+                    idx + 4).trim());
             return new DateTime(year, month, day, hours, min, sec);
-        }catch (NumberFormatException e) {
+        }
+        catch (NumberFormatException e) {
             return getNow().toDateTime();
         }
     }
 
-    public static String formatDiff(DateTime now, DateTime after) {
+
+    public static String formatDiff (DateTime now, DateTime after) {
         return df.format(calcDiff(now, after));
     }
 
+
     /**
      * converts time to the ISO8601 standard.
-     *
+     * 
      * @param time
      * @return
      */
-    public static String format(DateTime time) {
+    public static String format (DateTime time) {
         DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
         return fmt.print(time);
     }
 
-    public static String format(long time) {
+
+    public static String format (long time) {
         DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
         return fmt.print(time);
     }
 
+
     /**
      * calculate expiration time
-     *
+     * 
      * @param creation
-     * @param plus     time in seconds
+     * @param plus
+     *            time in seconds
      * @return
      */
-    public static DateTime plusSeconds(long creation, int plus) {
+    public static DateTime plusSeconds (long creation, int plus) {
         return new DateTime(creation).withZone(dtz).plusSeconds(plus);
     }
 
-    public static DateTime getExpiration(long now, int exp) {
+
+    public static DateTime getExpiration (long now, int exp) {
         return new DateTime(now).withZone(dtz).plusSeconds(exp);
     }
 
+
     /**
      * @param plus
      * @return
      */
-    public static DateTime plusSeconds(int plus) {
+    public static DateTime plusSeconds (int plus) {
         return getNow().withZone(dtz).plusSeconds(plus);
     }
 
-    public static DateTime plusHours(int hours) {
+
+    public static DateTime plusHours (int hours) {
         return getNow().withZone(dtz).plusHours(hours);
     }
 
-    public static DateTime plusMinutes(int minutes) {
+
+    public static DateTime plusMinutes (int minutes) {
         return getNow().withZone(dtz).plusMinutes(minutes);
     }
 
+
     /**
      * create time stamp from long value
-     *
-     * @param t time
+     * 
+     * @param t
+     *            time
      * @return Timestamp
      */
-    public static LocalDate getTimeStamp(long t) {
+    public static LocalDate getTimeStamp (long t) {
         return new DateTime(t).withZone(dtz).toLocalDate();
     }
 
-    public static DateTime getDate(int day, int month, int year) {
+
+    public static DateTime getDate (int day, int month, int year) {
         DateTime date = new DateTime().withZone(dtz);
         return date.withDate(year, month, day);
     }
 
-    public static String toString(long val, Locale locale) {
+
+    public static String toString (long val, Locale locale) {
         if (locale == Locale.GERMAN)
-            return new DateTime(val)
-                    .toString("dd. MMMM yyyy, HH:mm", Locale.GERMAN);
+            return new DateTime(val).toString("dd. MMMM yyyy, HH:mm",
+                    Locale.GERMAN);
         else
-            return new DateTime(val)
-                    .toString("MM-dd-yyyy, hh:mm", Locale.ENGLISH);
+            return new DateTime(val).toString("MM-dd-yyyy, hh:mm",
+                    Locale.ENGLISH);
 
     }
 
-    public static String dateToString(long val, int i) {
+
+    public static String dateToString (long val, int i) {
         switch (i) {
             case 1:
                 return new DateTime(val).toString("yyyy-MM");
@@ -192,14 +214,16 @@
 
     private static final List<DateTime> times = new ArrayList<>();
 
+
     @Deprecated
-    public static float benchmark(boolean getFinal) {
+    public static float benchmark (boolean getFinal) {
         float value = 0;
         times.add(getNow());
         if (getFinal && times.size() > 1) {
             value = floating(times.get(0), times.get(times.size() - 1));
             times.clear();
-        }else if (times.size() > 1)
+        }
+        else if (times.size() > 1)
             value = floating(times.get(times.size() - 2),
                     times.get(times.size() - 1));
         return value;
diff --git a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
index be187b7..4bc7055 100644
--- a/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
+++ b/src/main/java/de/ids_mannheim/korap/utils/UserPropertyReader.java
@@ -30,33 +30,39 @@
     private static Logger jlog = LoggerFactory
             .getLogger(UserPropertyReader.class);
 
-    public UserPropertyReader(String path) {
+
+    public UserPropertyReader (String path) {
         this.path = path;
         this.iface = BeansFactory.getKustvaktContext().getUserDBHandler();
         this.crypto = BeansFactory.getKustvaktContext().getEncryption();
     }
 
+
     @Override
-    public void load() {
+    public void load () {
         try {
             props = super.read(this.path);
             for (Map.Entry<String, Properties> e : props.entrySet()) {
                 try {
                     createUser(e.getKey(), e.getValue());
-                }catch (KustvaktException ex) {
+                }
+                catch (KustvaktException ex) {
                     jlog.error("KorAP-Exception: {} for user {}",
                             ex.getStatusCode(), e.getKey());
                 }
             }
             iface.createAccount(User.UserFactory.getDemoUser());
-        }catch (IOException e) {
+        }
+        catch (IOException e) {
             jlog.error("Could not read from path {}", path);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("KorAP-Exception: {}", e.getStatusCode());
         }
     }
 
-    private User createUser(String username, Properties p)
+
+    private User createUser (String username, Properties p)
             throws KustvaktException {
         KorAPUser user;
         if (username.equals(User.ADMINISTRATOR_NAME)) {
@@ -68,12 +74,14 @@
 
             try {
                 pass = crypto.produceSecureHash(pass);
-            }catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+            }
+            catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
                 throw new KustvaktException(StatusCodes.REQUEST_INVALID);
             }
             user.setPassword(pass);
             iface.createAccount(user);
-        }else {
+        }
+        else {
             user = User.UserFactory.getUser(username);
             Map<String, Object> vals = new HashMap<>();
             for (Map.Entry e : p.entrySet()) {
@@ -86,13 +94,14 @@
 
             try {
                 pass = crypto.produceSecureHash(pass);
-            }catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
+            }
+            catch (NoSuchAlgorithmException | UnsupportedEncodingException e) {
                 throw new KustvaktException(StatusCodes.REQUEST_INVALID);
             }
 
             user.setPassword(pass);
-            user.setAccountLocked(Boolean.valueOf(
-                    p.getProperty(username + ".lock", "false")));
+            user.setAccountLocked(Boolean.valueOf(p.getProperty(username
+                    + ".lock", "false")));
             user.setAccountCreation(TimeUtils.getNow().getMillis());
 
             //todo: make sure uri is set to 0, so sql queries work with the null value
@@ -106,12 +115,14 @@
             set.readDefaults(vals);
             set.validate(crypto);
 
-            UserDataDbIface dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(BeansFactory.getKustvaktContext().getUserDataDaos(), UserDetails.class);
+            UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                    BeansFactory.getKustvaktContext().getUserDataDaos(),
+                    UserDetails.class);
             dao.store(det);
 
-            dao = BeansFactory.getTypeFactory()
-                    .getTypedBean(BeansFactory.getKustvaktContext().getUserDataDaos(), UserSettings.class);
+            dao = BeansFactory.getTypeFactory().getTypedBean(
+                    BeansFactory.getKustvaktContext().getUserDataDaos(),
+                    UserSettings.class);
             dao.store(set);
         }
 
diff --git a/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java b/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
index 65fdafa..0207c54 100644
--- a/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/web/ClientsHandler.java
@@ -21,32 +21,37 @@
 
     private WebResource service;
 
-    public ClientsHandler(URI address) {
+
+    public ClientsHandler (URI address) {
         ClientConfig config = new DefaultClientConfig();
         Client client = Client.create(config);
         this.service = client.resource(address);
     }
 
-    public String getResponse(String path, String key, Object value) throws
-            KustvaktException {
+
+    public String getResponse (String path, String key, Object value)
+            throws KustvaktException {
         MultivaluedMap map = new MultivaluedMapImpl();
         map.add(key, value);
         try {
             return service.path(path).queryParams(map).get(String.class);
-        } catch (UniformInterfaceException e) {
+        }
+        catch (UniformInterfaceException e) {
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
         }
     }
 
-    public String getResponse(MultivaluedMap map, String... paths) throws
-            KustvaktException {
+
+    public String getResponse (MultivaluedMap map, String ... paths)
+            throws KustvaktException {
         try {
             WebResource resource = service;
             for (String p : paths)
                 resource = resource.path(p);
             resource = resource.queryParams(map);
             return resource.get(String.class);
-        } catch (UniformInterfaceException e) {
+        }
+        catch (UniformInterfaceException e) {
             throw new KustvaktException(StatusCodes.REQUEST_INVALID);
         }
     }
diff --git a/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java b/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
index b3fdb51..5b6ba71 100644
--- a/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
+++ b/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
@@ -29,7 +29,7 @@
  */
 public class KustvaktBaseServer {
 
-    public static void main(String[] args) throws Exception {
+    public static void main (String[] args) throws Exception {
         KustvaktConfiguration.loadLog4jLogger();
         KustvaktBaseServer server = new KustvaktBaseServer();
         KustvaktArgs kargs = server.readAttributes(args);
@@ -41,13 +41,13 @@
 
         KustvaktCacheManager.init();
 
-        kargs.setRootPackages(
-                new String[] { "de.ids_mannheim.korap.web.service.light" });
+        kargs.setRootPackages(new String[] { "de.ids_mannheim.korap.web.service.light" });
 
         server.startServer(kargs);
     }
 
-    protected KustvaktArgs readAttributes(String[] args) {
+
+    protected KustvaktArgs readAttributes (String[] args) {
         KustvaktArgs kargs = new KustvaktArgs();
         for (int i = 0; i < args.length; i++) {
             switch ((args[i])) {
@@ -79,7 +79,8 @@
         return kargs;
     }
 
-    public void runPreStart() {
+
+    public void runPreStart () {
         Set<Class<? extends BootableBeanInterface>> set = KustvaktClassLoader
                 .loadSubTypes(BootableBeanInterface.class);
 
@@ -89,7 +90,8 @@
             try {
                 iface = (BootableBeanInterface) cl.newInstance();
                 list.add(iface);
-            }catch (InstantiationException | IllegalAccessException e) {
+            }
+            catch (InstantiationException | IllegalAccessException e) {
                 continue;
             }
         }
@@ -99,11 +101,11 @@
             for (BootableBeanInterface iface : new ArrayList<>(list)) {
                 try {
                     iface.load(BeansFactory.getKustvaktContext());
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     // don't do anything!
-                    System.out.println(
-                            "An error occurred in class " + iface.getClass()
-                                    .getSimpleName() + "!\n" + e);
+                    System.out.println("An error occurred in class "
+                            + iface.getClass().getSimpleName() + "!\n" + e);
                     continue;
                 }
                 list.remove(iface);
@@ -115,15 +117,17 @@
         }
     }
 
-    protected void startServer(KustvaktArgs kargs) {
+
+    protected void startServer (KustvaktArgs kargs) {
         if (kargs.init)
             runPreStart();
 
         if (kargs.port == -1)
-            kargs.setPort(BeansFactory.getKustvaktContext().getConfiguration().getPort());
+            kargs.setPort(BeansFactory.getKustvaktContext().getConfiguration()
+                    .getPort());
 
-        System.out.println(
-                "Starting Kustvakt Service on port '" + kargs.port + "'");
+        System.out.println("Starting Kustvakt Service on port '" + kargs.port
+                + "'");
         try {
             // from http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
             Server server = new Server();
@@ -140,9 +144,8 @@
                     kargs.rootPackages);
 
             // from http://stackoverflow.com/questions/7421574/embedded-jetty-with-jersey-or-resteasy
-            contextHandler
-                    .addServlet(new ServletHolder(new ServletContainer(rc)),
-                            "/api/*");
+            contextHandler.addServlet(new ServletHolder(
+                    new ServletContainer(rc)), "/api/*");
 
             server.setHandler(contextHandler);
 
@@ -151,14 +154,15 @@
                         kargs.sslContext);
                 sslConnector.setPort(8443);
                 sslConnector.setMaxIdleTime(60000);
-                server.setConnectors(
-                        new Connector[] { connector, sslConnector });
-            }else
+                server.setConnectors(new Connector[] { connector, sslConnector });
+            }
+            else
                 server.setConnectors(new Connector[] { connector });
 
             server.start();
             server.join();
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             e.printStackTrace();
         }
 
@@ -175,7 +179,8 @@
         private String[] rootPackages;
         private boolean init;
 
-        public KustvaktArgs() {
+
+        public KustvaktArgs () {
             this.port = -1;
             this.sslContext = null;
             this.debug = false;
diff --git a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
index 18440a2..95d63f7 100644
--- a/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
+++ b/src/main/java/de/ids_mannheim/korap/web/SearchKrill.java
@@ -1,5 +1,6 @@
 // Connector to the Lucene Backend
 package de.ids_mannheim.korap.web;
+
 import de.ids_mannheim.korap.Krill;
 import de.ids_mannheim.korap.KrillCollection;
 import de.ids_mannheim.korap.KrillIndex;
@@ -15,21 +16,24 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.List;
+
 /**
  * The SearchKrill class allows for searching in the
  * Lucene based Krill backend by applying KoralQuery.
- *
+ * 
  * @author Nils Diewald
  */
 public class SearchKrill {
     private final static Logger qlog = KustvaktLogger.getLogger("queryLogger");
-    private final static Logger log = LoggerFactory
+    private final static Logger jlog = LoggerFactory
             .getLogger(SearchKrill.class);
     // Temporary
     String indexDir = "/data/prep_corpus/index/";
     String i = "/Users/hanl/Projects/prep_corpus";
     String klinux10 = "/vol/work/hanl/indices";
     private KrillIndex index;
+
+
     /**
      * Constructor
      */
@@ -41,54 +45,74 @@
             }
             else {
                 File f = new File(path);
-                log.info("Loading index from " + path);
+                jlog.info("Loading index from " + path);
                 if (!f.exists()) {
-                    KustvaktLogger.ERROR_LOGGER.error("Index not found!");
+                    jlog.error("Index not found!");
                     System.exit(-1);
                 }
                 this.index = new KrillIndex(new MMapDirectory(Paths.get(path)));
             };
-        } catch (IOException e) {
-            KustvaktLogger.ERROR_LOGGER
-                    .error("Unable to loadSubTypes index: {}", e.getMessage());
+        }
+        catch (IOException e) {
+            jlog.error("Unable to loadSubTypes index: {}", e.getMessage());
         };
-    };
+    }
+
+
     public KrillIndex getIndex () {
         return this.index;
-    };
+    }
+
+    ;
+
+
     /**
      * Search in the Lucene index.
-     *
-     * @param json JSON-LD string with search and potential meta filters.
+     * 
+     * @param json
+     *            JSON-LD string with search and potential meta
+     *            filters.
      */
-    public String search(String json) {
+    public String search (String json) {
         qlog.trace(json);
         if (this.index != null)
             return new Krill(json).apply(this.index).toJsonString();
         Result kr = new Result();
         kr.addError(601, "Unable to find index");
         return kr.toJsonString();
-    };
+    }
+
+    ;
+
+
     /**
      * Search in the Lucene index and return matches as token lists.
-     *
-     * @param json JSON-LD string with search and potential meta filters.
+     * 
+     * @param json
+     *            JSON-LD string with search and potential meta
+     *            filters.
      */
     @Deprecated
-    public String searchTokenList(String json) {
+    public String searchTokenList (String json) {
         qlog.trace(json);
         if (this.index != null)
             return new Krill(json).apply(this.index).toTokenListJsonString();
         Result kr = new Result();
         kr.addError(601, "Unable to find index");
         return kr.toJsonString();
-    };
+    }
+
+    ;
+
+
     /**
-     * Get info on a match - by means of a richly annotated html snippet.
-     *
-     * @param id match id
+     * Get info on a match - by means of a richly annotated html
+     * snippet.
+     * 
+     * @param id
+     *            match id
      */
-    public String getMatch(String id) {
+    public String getMatch (String id) {
         if (this.index != null) {
             try {
                 return this.index.getMatch(id).toJsonString();
@@ -102,18 +126,22 @@
         Match km = new Match();
         km.addError(601, "Unable to find index");
         return km.toJsonString();
-    };
-    public String getMatch(String id, List<String> foundries,
+    }
+
+    ;
+
+
+    public String getMatch (String id, List<String> foundries,
             List<String> layers, boolean includeSpans,
             boolean includeHighlights, boolean sentenceExpansion) {
         if (this.index != null) {
             try {
 
-                return this.index
-                        .getMatchInfo(id, "tokens", true, foundries, layers,
-                                includeSpans, includeHighlights,
-                                sentenceExpansion).toJsonString();
-            } catch (QueryException qe) {
+                return this.index.getMatchInfo(id, "tokens", true, foundries,
+                        layers, includeSpans, includeHighlights,
+                        sentenceExpansion).toJsonString();
+            }
+            catch (QueryException qe) {
                 Match km = new Match();
                 km.addError(qe.getErrorCode(), qe.getMessage());
                 return km.toJsonString();
@@ -123,17 +151,27 @@
         Match km = new Match();
         km.addError(601, "Unable to find index");
         return km.toJsonString();
-    };
+    }
+
+    ;
+
+
     /**
-     * Get info on a match - by means of a richly annotated html snippet.
-     *
-     * @param id                match id
-     * @param foundry           the foundry of interest - may be null
-     * @param layer             the layer of interest - may be null
-     * @param includeSpans      Should spans be included (or only token infos)?
-     * @param includeHighlights Should highlight markup be included?
+     * Get info on a match - by means of a richly annotated html
+     * snippet.
+     * 
+     * @param id
+     *            match id
+     * @param foundry
+     *            the foundry of interest - may be null
+     * @param layer
+     *            the layer of interest - may be null
+     * @param includeSpans
+     *            Should spans be included (or only token infos)?
+     * @param includeHighlights
+     *            Should highlight markup be included?
      */
-    public String getMatch(String id, String foundry, String layer,
+    public String getMatch (String id, String foundry, String layer,
             boolean includeSpans, boolean includeHighlights,
             boolean sentenceExpansion) {
 
@@ -151,8 +189,7 @@
                   boolean extendToSentence
                 */
                 return this.index.getMatchInfo(id, "tokens", foundry, layer,
-                        includeSpans, includeHighlights,
-                        sentenceExpansion)
+                        includeSpans, includeHighlights, sentenceExpansion)
                         .toJsonString();
             }
             catch (QueryException qe) {
@@ -164,16 +201,19 @@
         Match km = new Match();
         km.addError(601, "Unable to find index");
         return km.toJsonString();
-    };
+    }
+
+    ;
 
 
     /**
      * Get statistics on (virtual) collections.
-     *
-     * @param json JSON-LD string with potential meta filters.
+     * 
+     * @param json
+     *            JSON-LD string with potential meta filters.
      */
     @Deprecated
-    public String getStatistics(String json) {
+    public String getStatistics (String json) {
         qlog.trace(json);
         if (this.index == null) {
             return "{\"documents\" : -1, error\" : \"No index given\" }";
@@ -182,10 +222,7 @@
         KrillCollection kc = new KrillCollection(json);
         // Set index
         kc.setIndex(this.index);
-        long docs = 0,
-                tokens = 0,
-                sentences = 0,
-                paragraphs = 0;
+        long docs = 0, tokens = 0, sentences = 0, paragraphs = 0;
         // Get numbers from index (currently slow)
         try {
             docs = kc.numberOf("documents");
@@ -202,10 +239,16 @@
                 .append(tokens).append(",\"sentences\":").append(sentences)
                 .append(",\"paragraphs\":").append(paragraphs).append("}");
         return sb.toString();
-    };
-    public String getMatchId(String type, String docid, String tofrom) {
+    }
+
+    ;
+
+
+    public String getMatchId (String type, String docid, String tofrom) {
         return new StringBuilder().append("match-").append(type).append("!")
                 .append(type).append("_").append(docid).append("-")
                 .append(tofrom).toString();
-    };
+    }
+
+    ;
 };
\ No newline at end of file
diff --git a/src/main/java/de/ids_mannheim/korap/web/TRACE.java b/src/main/java/de/ids_mannheim/korap/web/TRACE.java
index e33089d..05d511b 100644
--- a/src/main/java/de/ids_mannheim/korap/web/TRACE.java
+++ b/src/main/java/de/ids_mannheim/korap/web/TRACE.java
@@ -10,8 +10,7 @@
  * @author hanl
  * @date 03/07/2014
  */
-@Target({ElementType.METHOD})
+@Target({ ElementType.METHOD })
 @Retention(RetentionPolicy.RUNTIME)
 @HttpMethod("TRACE")
-public @interface TRACE {
-}
+public @interface TRACE {}
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java
index cc4e68c..df3157b 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/AuthFilter.java
@@ -22,13 +22,15 @@
 
     private AuthenticationManagerIface userController;
 
-    public AuthFilter() {
+
+    public AuthFilter () {
         this.userController = BeansFactory.getKustvaktContext()
                 .getAuthenticationManager();
     }
 
+
     @Override
-    public ContainerRequest filter(ContainerRequest request) {
+    public ContainerRequest filter (ContainerRequest request) {
         String host = request.getHeaderValue(ContainerRequest.HOST);
         String ua = request.getHeaderValue(ContainerRequest.USER_AGENT);
 
@@ -37,15 +39,17 @@
         if (authentication != null && !authentication.isEmpty()) {
             TokenContext context;
             try {
-                context = userController
-                        .getTokenStatus(authentication, host, ua);
-            }catch (KustvaktException e) {
+                context = userController.getTokenStatus(authentication, host,
+                        ua);
+            }
+            catch (KustvaktException e) {
                 throw KustvaktResponseHandler.throwAuthenticationException();
             }
             // fixme: give reason why access is not granted?
-            if (context != null && context.isValid() && (
-                    (context.isSecureRequired() && request.isSecure())
-                            | !context.isSecureRequired()))
+            if (context != null
+                    && context.isValid()
+                    && ((context.isSecureRequired() && request.isSecure()) | !context
+                            .isSecureRequired()))
                 request.setSecurityContext(new KorAPContext(context));
             else
                 throw KustvaktResponseHandler.throwAuthenticationException();
@@ -53,13 +57,15 @@
         return request;
     }
 
+
     @Override
-    public ContainerRequestFilter getRequestFilter() {
+    public ContainerRequestFilter getRequestFilter () {
         return this;
     }
 
+
     @Override
-    public ContainerResponseFilter getResponseFilter() {
+    public ContainerResponseFilter getResponseFilter () {
         return null;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
index ff15fe1..4bdaa07 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
@@ -11,29 +11,33 @@
 /**
  * @author hanl
  * @date 11/12/2014
- * <p/>
- * endpoint filter to block access to an endpoint, in case no anonymous access should be allowed!
+ *       <p/>
+ *       endpoint filter to block access to an endpoint, in case no
+ *       anonymous access should be allowed!
  */
 @Provider
 public class BlockingFilter implements ContainerRequestFilter, ResourceFilter {
 
     @Override
-    public ContainerRequest filter(ContainerRequest request) {
+    public ContainerRequest filter (ContainerRequest request) {
         try {
             request.getUserPrincipal();
-        }catch (UnsupportedOperationException e) {
+        }
+        catch (UnsupportedOperationException e) {
             throw KustvaktResponseHandler.throwAuthenticationException();
         }
         return request;
     }
 
+
     @Override
-    public ContainerRequestFilter getRequestFilter() {
+    public ContainerRequestFilter getRequestFilter () {
         return this;
     }
 
+
     @Override
-    public ContainerResponseFilter getResponseFilter() {
+    public ContainerResponseFilter getResponseFilter () {
         return null;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java b/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java
index 2626349..107c5e1 100644
--- a/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java
+++ b/src/main/java/de/ids_mannheim/korap/web/filter/DefaultFilter.java
@@ -24,8 +24,9 @@
     @Context
     UriInfo info;
 
+
     @Override
-    public ContainerRequest filter(ContainerRequest request) {
+    public ContainerRequest filter (ContainerRequest request) {
         String host = request.getHeaderValue(ContainerRequest.HOST);
         String ua = request.getHeaderValue(ContainerRequest.USER_AGENT);
         String authentication = request
@@ -36,18 +37,20 @@
             Principal pr = null;
             try {
                 pr = request.getUserPrincipal();
-            }catch (UnsupportedOperationException e) {
+            }
+            catch (UnsupportedOperationException e) {
                 // do nothing
             }
             if (pr == null)
-                request.setSecurityContext(
-                        new KorAPContext(createShorterToken(host, ua)));
+                request.setSecurityContext(new KorAPContext(createShorterToken(
+                        host, ua)));
 
         }
         return request;
     }
 
-    private TokenContext createShorterToken(String host, String agent) {
+
+    private TokenContext createShorterToken (String host, String agent) {
         User demo = User.UserFactory.getDemoUser();
         TokenContext c = new TokenContext();
         c.setUsername(demo.getUsername());
@@ -59,13 +62,15 @@
         return c;
     }
 
+
     @Override
-    public ContainerRequestFilter getRequestFilter() {
+    public ContainerRequestFilter getRequestFilter () {
         return this;
     }
 
+
     @Override
-    public ContainerResponseFilter getResponseFilter() {
+    public ContainerResponseFilter getResponseFilter () {
         return null;
     }
 }
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 3fdec88..fc32b67 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
@@ -39,8 +39,10 @@
     private Map<String, String> customVars;
     private AuthenticationManagerIface controller;
 
-    public PiwikFilter() {
-        controller = BeansFactory.getKustvaktContext().getAuthenticationManager();
+
+    public PiwikFilter () {
+        controller = BeansFactory.getKustvaktContext()
+                .getAuthenticationManager();
         ClientConfig config = new DefaultClientConfig();
         Client client = Client.create(config);
         if (jlog.isDebugEnabled())
@@ -50,7 +52,8 @@
         this.customVars = new HashMap<>();
     }
 
-    private void send(ContainerRequest request) {
+
+    private void send (ContainerRequest request) {
         Random random = new SecureRandom();
         MultivaluedMap<String, String> params = new MultivaluedMapImpl();
         params.add("idsite", "2");
@@ -66,7 +69,8 @@
         if (request.getAcceptableLanguages() != null)
             l = request.getAcceptableLanguages().get(0);
         try {
-            service.path("piwik/piwik.php").queryParam("idsite", "2")
+            service.path("piwik/piwik.php")
+                    .queryParam("idsite", "2")
                     .queryParam("rec", "1")
                     //todo check for empty container
                     .queryParam("_cvar", translateCustomData())
@@ -79,16 +83,17 @@
                     .header("Host", request.getHeaderValue("Host"))
                     .header("User-Agent", request.getHeaderValue("User-Agent"))
                     .acceptLanguage(l).method("GET");
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             // do nothing if piwik not available!
         }
     }
 
-    private String translateCustomData() {
+
+    private String translateCustomData () {
         final Map<String, List<String>> customVariables = new HashMap<String, List<String>>();
         int i = 0;
-        for (final Map.Entry<String, String> entry : this.customVars
-                .entrySet()) {
+        for (final Map.Entry<String, String> entry : this.customVars.entrySet()) {
             i++;
             final List<String> list = new ArrayList<String>();
             list.add(entry.getKey());
@@ -100,14 +105,15 @@
         json.add(customVariables);
 
         // remove unnecessary parent square brackets from JSON-string
-        String jsonString = json.toString()
-                .substring(1, json.toString().length() - 1);
+        String jsonString = json.toString().substring(1,
+                json.toString().length() - 1);
         customVars.clear();
         return jsonString;
     }
 
+
     @Override
-    public ContainerRequest filter(ContainerRequest request) {
+    public ContainerRequest filter (ContainerRequest request) {
         if (ENABLED) {
             try {
                 TokenContext context = (TokenContext) request
@@ -118,7 +124,8 @@
                         .getUserData(user, UserSettings.class);
                 if ((Boolean) data.get(Attributes.COLLECT_AUDITING_DATA))
                     customVars.put("username", context.getUsername());
-            }catch (KustvaktException | UnsupportedOperationException e) {
+            }
+            catch (KustvaktException | UnsupportedOperationException e) {
                 //do nothing
             }
             send(request);
@@ -126,13 +133,15 @@
         return request;
     }
 
+
     @Override
-    public ContainerRequestFilter getRequestFilter() {
+    public ContainerRequestFilter getRequestFilter () {
         return this;
     }
 
+
     @Override
-    public ContainerResponseFilter getResponseFilter() {
+    public ContainerResponseFilter getResponseFilter () {
         return null;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/BootupInterface.java b/src/main/java/de/ids_mannheim/korap/web/service/BootupInterface.java
index 8ed79af..f421e92 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/BootupInterface.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/BootupInterface.java
@@ -8,8 +8,9 @@
  */
 public interface BootupInterface {
 
-    void load() throws KustvaktException;
+    void load () throws KustvaktException;
 
-    Class<? extends BootupInterface>[] getDependencies();
+
+    Class<? extends BootupInterface>[] getDependencies ();
 
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
index aaf5146..a88cb1b 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/CollectionLoader.java
@@ -21,7 +21,7 @@
 public class CollectionLoader implements BootableBeanInterface {
 
     @Override
-    public void load(ContextHolder beans) throws KustvaktException {
+    public void load (ContextHolder beans) throws KustvaktException {
         SecurityManager.overrideProviders(beans);
         ResourceFinder.overrideProviders(beans);
 
@@ -64,8 +64,9 @@
                     "creating collections caused errors", result);
     }
 
+
     @Override
-    public Class<? extends BootableBeanInterface>[] getDependencies() {
+    public Class<? extends BootableBeanInterface>[] getDependencies () {
         return new Class[] { UserLoader.class };
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java
index f568c88..5765778 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/PolicyLoader.java
@@ -19,7 +19,7 @@
 public class PolicyLoader implements BootableBeanInterface {
 
     @Override
-    public void load(ContextHolder beans) throws KustvaktException {
+    public void load (ContextHolder beans) throws KustvaktException {
         SecurityManager.overrideProviders(beans);
         ResourceFinder.overrideProviders(beans);
 
@@ -47,8 +47,9 @@
         builder.create();
     }
 
+
     @Override
-    public Class<? extends BootableBeanInterface>[] getDependencies() {
+    public Class<? extends BootableBeanInterface>[] getDependencies () {
         return new Class[] { UserLoader.class };
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java b/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java
index 4ea11db..14614c6 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/UserLoader.java
@@ -12,15 +12,14 @@
 public class UserLoader implements BootableBeanInterface {
 
     @Override
-    public void load(ContextHolder beans) throws KustvaktException {
-        AuthenticationManagerIface manager = beans
-                .getAuthenticationManager();
-        manager.createUserAccount(KustvaktConfiguration.KUSTVAKT_USER,
-                false);
+    public void load (ContextHolder beans) throws KustvaktException {
+        AuthenticationManagerIface manager = beans.getAuthenticationManager();
+        manager.createUserAccount(KustvaktConfiguration.KUSTVAKT_USER, false);
     }
 
+
     @Override
-    public Class<? extends BootableBeanInterface>[] getDependencies() {
+    public Class<? extends BootableBeanInterface>[] getDependencies () {
         return new Class[0];
     }
 }
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 27de612..23852b1 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
@@ -41,28 +41,32 @@
     private static Logger jlog = KustvaktLogger.getLogger(AuthService.class);
 
     private AuthenticationManagerIface controller;
+
+
     //    private SendMail mail;
 
-    public AuthService() {
+    public AuthService () {
         this.controller = BeansFactory.getKustvaktContext()
                 .getAuthenticationManager();
         //todo: replace with real property values
         //        this.mail = new SendMail(ExtConfiguration.getMailProperties());
     }
 
+
     /**
-     * represents json string with data. All GUI clients can access this method to get certain default values
+     * represents json string with data. All GUI clients can access
+     * this method to get certain default values
      * --> security checks?
-     *
+     * 
      * @return String
      */
     @Deprecated
     @GET
     @Path("bootstrap")
     @Produces(MediaType.APPLICATION_JSON)
-    public Response bootstrap() {
+    public Response bootstrap () {
         Map m = new HashMap();
-//        m.put("settings", new UserSettings().toObjectMap());
+        //        m.put("settings", new UserSettings().toObjectMap());
         m.put("ql", BeansFactory.getKustvaktContext().getConfiguration()
                 .getQueryLanguages());
         m.put("SortTypes", null); // types of sorting that are supported!
@@ -70,11 +74,12 @@
         return Response.ok(JsonUtils.toJSON(m)).build();
     }
 
+
     // fixme: moved to user
     @GET
     @Path("status")
     @ResourceFilters({ AuthFilter.class, DefaultFilter.class })
-    public Response getStatus(@Context SecurityContext context,
+    public Response getStatus (@Context SecurityContext context,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
             @Context Locale locale) {
@@ -82,9 +87,10 @@
         return Response.ok(ctx.toJSON()).build();
     }
 
+
     @GET
     @Path("apiToken")
-    public Response requestAPIToken(@Context HttpHeaders headers,
+    public Response requestAPIToken (@Context HttpHeaders headers,
             @Context Locale locale,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
@@ -103,8 +109,8 @@
             throw KustvaktResponseHandler
                     .throwit(StatusCodes.PERMISSION_DENIED);
 
-        if (values[0].equalsIgnoreCase("null") | values[1]
-                .equalsIgnoreCase("null"))
+        if (values[0].equalsIgnoreCase("null")
+                | values[1].equalsIgnoreCase("null"))
             // is actual an invalid request
             throw KustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
 
@@ -119,21 +125,23 @@
             Userdata data = this.controller
                     .getUserData(user, UserDetails.class);
             // todo: is this necessary?
-//            attr.putAll(data.fields());
+            //            attr.putAll(data.fields());
             context = controller.createTokenContext(user, attr,
                     Attributes.API_AUTHENTICATION);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
 
         return Response.ok(context.toResponse()).build();
     }
 
+
     // todo:
     @Deprecated
     @GET
     @Path("refresh")
-    public Response refresh(@Context SecurityContext context,
+    public Response refresh (@Context SecurityContext context,
             @Context Locale locale) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         TokenContext newContext;
@@ -148,9 +156,10 @@
         return null;
     }
 
+
     @GET
     @Path("sessionToken")
-    public Response requestSession(@Context HttpHeaders headers,
+    public Response requestSession (@Context HttpHeaders headers,
             @Context Locale locale,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host) {
@@ -172,8 +181,8 @@
             throw KustvaktResponseHandler
                     .throwit(StatusCodes.PERMISSION_DENIED);
 
-        if (values[0].equalsIgnoreCase("null") | values[1]
-                .equalsIgnoreCase("null"))
+        if (values[0].equalsIgnoreCase("null")
+                | values[1].equalsIgnoreCase("null"))
             throw KustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
 
         Map<String, Object> attr = new HashMap<>();
@@ -184,19 +193,21 @@
             User user = controller.authenticate(0, values[0], values[1], attr);
             context = controller.createTokenContext(user, attr,
                     Attributes.SESSION_AUTHENTICATION);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().entity(context.toJSON()).build();
     }
 
+
     // fixme: security issues: setup shibboleth compatible authentication system
     // todo: will be purged with token authentication --> shib is client side
     @POST
     @Consumes("application/x-www-form-urlencoded")
     @Produces("application/json")
     @Path("shibboleth")
-    public Response loginshib(@Context HttpHeaders headers,
+    public Response loginshib (@Context HttpHeaders headers,
             @Context Locale locale,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
@@ -215,23 +226,24 @@
             // todo: distinguish type KorAP/Shibusers
             User user = controller.authenticate(1, null, null, attr);
             context = controller.createTokenContext(user, attr, null);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().entity(context.toJSON()).build();
     }
 
+
     //fixme: moved from userservice
     @GET
     @Path("logout")
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
-            PiwikFilter.class })
-    public Response logout(@Context SecurityContext ctx,
-            @Context Locale locale) {
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class })
+    public Response logout (@Context SecurityContext ctx, @Context Locale locale) {
         TokenContext context = (TokenContext) ctx.getUserPrincipal();
         try {
             controller.logout(context);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Logout Exception", e);
             throw KustvaktResponseHandler.throwit(e);
         }
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 463e068..76bd9de 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
@@ -63,19 +63,21 @@
     private EncryptionIface crypto;
     private KustvaktConfiguration config;
 
-    public OAuthService() {
-        this.handler = new OAuth2Handler(
-                BeansFactory.getKustvaktContext().getPersistenceClient());
+
+    public OAuthService () {
+        this.handler = new OAuth2Handler(BeansFactory.getKustvaktContext()
+                .getPersistenceClient());
         this.controller = BeansFactory.getKustvaktContext()
                 .getAuthenticationManager();
         this.crypto = BeansFactory.getKustvaktContext().getEncryption();
         this.config = BeansFactory.getKustvaktContext().getConfiguration();
     }
 
+
     @POST
     @Path("unregister")
     @ResourceFilters({ AuthFilter.class, BlockingFilter.class })
-    public Response unregisterClient(@Context SecurityContext context,
+    public Response unregisterClient (@Context SecurityContext context,
             @HeaderParam("Host") String host,
             @QueryParam("client_secret") String secret,
             @QueryParam("client_id") String client_id) {
@@ -85,41 +87,43 @@
         try {
             this.handler.removeClient(info,
                     this.controller.getUser(ctx.getUsername()));
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().build();
     }
 
+
     @POST
     @Path("register")
     @ResourceFilters({ AuthFilter.class, BlockingFilter.class })
-    public Response registerClient(@Context SecurityContext context,
+    public Response registerClient (@Context SecurityContext context,
             @HeaderParam("Host") String host,
             @QueryParam("redirect_url") String rurl) {
         ClientInfo info = new ClientInfo(crypto.createID(),
                 crypto.createToken());
         info.setUrl(host);
         if (rurl == null)
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.ILLEGAL_ARGUMENT, "Missing parameter!",
-                            "redirect_url");
+            throw KustvaktResponseHandler.throwit(StatusCodes.ILLEGAL_ARGUMENT,
+                    "Missing parameter!", "redirect_url");
         info.setRedirect_uri(rurl);
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         try {
             this.handler.registerClient(info,
                     this.controller.getUser(ctx.getUsername()));
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(info.toJSON()).build();
     }
 
+
     @GET
     @Path("info")
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
-            PiwikFilter.class })
-    public Response getStatus(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class })
+    public Response getStatus (@Context SecurityContext context,
             @QueryParam("scope") String scopes) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         Map<String, Object> details;
@@ -131,19 +135,21 @@
             Set<String> base_scope = StringUtils.toSet(scopes, " ");
             base_scope.retainAll(StringUtils.toSet(scopes));
             scopes = StringUtils.toString(base_scope);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         // json format with scope callback parameter
         // todo: add other scopes as well!
-        return Response.ok(JsonUtils
-                .toJSON(Scopes.mapScopes(scopes, details))).build();
+        return Response.ok(JsonUtils.toJSON(Scopes.mapScopes(scopes, details)))
+                .build();
     }
 
+
     @GET
     @Path("authorizations")
     @ResourceFilters({ AuthFilter.class, BlockingFilter.class })
-    public Response getAuthorizations(@Context SecurityContext context,
+    public Response getAuthorizations (@Context SecurityContext context,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host) {
         // works on all tokens, but access to native apps cannot be revoked!
@@ -155,11 +161,13 @@
             if (auths.isEmpty())
                 return Response.noContent().build();
             return Response.ok(JsonUtils.toJSON(auths)).build();
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
     }
 
+
     // todo: scopes for access_token are defined here
     // todo: if user already has an access token registered for client and application, then redirect to token endpoint to retrieve that token
     // todo: demo account should be disabled for this function --> if authentication failed, client must redirect to login url (little login window)
@@ -168,12 +176,12 @@
     @Consumes("application/x-www-form-urlencoded")
     @Produces("application/json")
     @ResourceFilters({ BlockingFilter.class })
-    public Response authorize(@Context HttpServletRequest request,
+    public Response authorize (@Context HttpServletRequest request,
             @Context SecurityContext context,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
-            MultivaluedMap<String, Object> form)
-            throws OAuthSystemException, URISyntaxException {
+            MultivaluedMap<String, Object> form) throws OAuthSystemException,
+            URISyntaxException {
         // user needs to be authenticated to this service!
         TokenContext c = (TokenContext) context.getUserPrincipal();
 
@@ -198,10 +206,10 @@
 
             try {
                 user = controller.getUser(c.getUsername());
-                Userdata data = controller
-                        .getUserData(user, UserDetails.class);
+                Userdata data = controller.getUserData(user, UserDetails.class);
                 user.addUserData(data);
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 throw KustvaktResponseHandler.throwit(e);
             }
 
@@ -214,8 +222,9 @@
             ClientInfo info = this.handler
                     .getClient(oauthRequest.getClientId());
 
-            if (info == null || !info.getClient_secret()
-                    .equals(oauthRequest.getClientSecret())) {
+            if (info == null
+                    || !info.getClient_secret().equals(
+                            oauthRequest.getClientSecret())) {
                 OAuthResponse res = OAuthASResponse
                         .errorResponse(HttpServletResponse.SC_BAD_REQUEST)
                         .setError(OAuthError.CodeResponse.UNAUTHORIZED_CLIENT)
@@ -225,8 +234,7 @@
                         .entity(res.getBody()).build();
             }
 
-            if (!info.getRedirect_uri()
-                    .contains(oauthRequest.getRedirectURI())) {
+            if (!info.getRedirect_uri().contains(oauthRequest.getRedirectURI())) {
                 OAuthResponse res = OAuthASResponse
                         .errorResponse(HttpServletResponse.SC_BAD_REQUEST)
                         .setError(OAuthError.CodeResponse.INVALID_REQUEST)
@@ -236,15 +244,16 @@
                         .entity(res.getBody()).build();
             }
 
-            String accessToken = this.handler
-                    .getToken(oauthRequest.getClientId(), user.getId());
+            String accessToken = this.handler.getToken(
+                    oauthRequest.getClientId(), user.getId());
 
             //todo: test correct redirect and parameters
             if (accessToken != null) {
                 // fixme: correct status code?
                 OAuthASResponse.OAuthResponseBuilder builder = OAuthASResponse
                         .status(HttpServletResponse.SC_FOUND);
-                final OAuthResponse response = builder.location("/oauth2/token")
+                final OAuthResponse response = builder
+                        .location("/oauth2/token")
                         .setParam(OAuth.OAUTH_CLIENT_ID,
                                 oauthRequest.getClientId())
                         .setParam(OAuth.OAUTH_CLIENT_SECRET,
@@ -272,10 +281,11 @@
                 try {
                     AuthCodeInfo codeInfo = new AuthCodeInfo(
                             info.getClient_id(), authorizationCode);
-                    codeInfo.setScopes(StringUtils
-                            .toString(oauthRequest.getScopes(), " "));
+                    codeInfo.setScopes(StringUtils.toString(
+                            oauthRequest.getScopes(), " "));
                     this.handler.authorize(codeInfo, user);
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
                 builder.setParam(OAuth.OAUTH_RESPONSE_TYPE,
@@ -283,7 +293,8 @@
                 builder.setCode(authorizationCode);
                 response = builder.buildBodyMessage();
 
-            }else if (responseType.contains(ResponseType.TOKEN.toString())) {
+            }
+            else if (responseType.contains(ResponseType.TOKEN.toString())) {
                 OAuthASResponse.OAuthTokenResponseBuilder builder = OAuthASResponse
                         .tokenResponse(HttpServletResponse.SC_OK);
                 builder.setParam(OAuth.OAUTH_RESPONSE_TYPE,
@@ -308,12 +319,14 @@
                                 .createTokenContext(user, attr, null);
                         builder.setParam(new_context.getTokenType(),
                                 new_context.getToken());
-                    }catch (KustvaktException e) {
+                    }
+                    catch (KustvaktException e) {
                         throw KustvaktResponseHandler.throwit(e);
                     }
                 }
                 response = builder.buildBodyMessage();
-            }else {
+            }
+            else {
                 OAuthResponse res = OAuthASResponse
                         .errorResponse(HttpServletResponse.SC_BAD_REQUEST)
                         .setError(
@@ -338,30 +351,34 @@
 
             return Response.status(response.getResponseStatus())
                     .location(new URI(response.getLocationUri())).build();
-        }catch (OAuthProblemException e) {
+        }
+        catch (OAuthProblemException e) {
             final Response.ResponseBuilder responseBuilder = Response
                     .status(HttpServletResponse.SC_BAD_REQUEST);
             String redirectUri = e.getRedirectUri();
 
             if (OAuthUtils.isEmpty(redirectUri))
-                throw new WebApplicationException(responseBuilder
-                        .entity("OAuth callback url needs to be provided by client!!!\n")
-                        .build());
+                throw new WebApplicationException(
+                        responseBuilder
+                                .entity("OAuth callback url needs to be provided by client!!!\n")
+                                .build());
 
             final OAuthResponse response = OAuthASResponse
                     .errorResponse(HttpServletResponse.SC_BAD_REQUEST).error(e)
                     .location(redirectUri).buildQueryMessage();
             final URI location = new URI(response.getLocationUri());
             return responseBuilder.location(location).build();
-        }catch (OAuthSystemException | URISyntaxException | KustvaktException e) {
+        }
+        catch (OAuthSystemException | URISyntaxException | KustvaktException e) {
             e.printStackTrace();
         }
         return Response.noContent().build();
     }
 
+
     @POST
     @Path("revoke")
-    public Response revokeToken(@Context HttpServletRequest request,
+    public Response revokeToken (@Context HttpServletRequest request,
             @Context SecurityContext context,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host)
@@ -379,33 +396,37 @@
                         .entity(res.getBody()).build();
             }
 
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
             // fixme: do something
             /**
-             * final Response.ResponseBuilder responseBuilder = Response
-             .status(HttpServletResponse.SC_FOUND);
-             String redirectUri = e.getRedirectUri();
-
-             final OAuthResponse response = OAuthASResponse
-             .errorResponse(HttpServletResponse.SC_FOUND).error(e)
-             .location(redirectUri).buildQueryMessage();
-             final URI location = new URI(response.getLocationUri());
-             return responseBuilder.location(location).build();
+             * final Response.ResponseBuilder responseBuilder =
+             * Response
+             * .status(HttpServletResponse.SC_FOUND);
+             * String redirectUri = e.getRedirectUri();
+             * 
+             * final OAuthResponse response = OAuthASResponse
+             * .errorResponse(HttpServletResponse.SC_FOUND).error(e)
+             * .location(redirectUri).buildQueryMessage();
+             * final URI location = new
+             * URI(response.getLocationUri());
+             * return responseBuilder.location(location).build();
              */
         }
 
         return Response.ok().build();
     }
 
+
     @POST
     @Consumes("application/x-www-form-urlencoded")
     @Produces("application/json")
     @Path("token")
-    public Response requestToken(@Context HttpServletRequest request,
+    public Response requestToken (@Context HttpServletRequest request,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
-            @HeaderParam(ContainerRequest.HOST) String host,
-            MultivaluedMap form) throws OAuthSystemException {
+            @HeaderParam(ContainerRequest.HOST) String host, MultivaluedMap form)
+            throws OAuthSystemException {
         boolean openid_valid = false;
         User user = null;
         OAuthTokenRequest oauthRequest;
@@ -415,11 +436,10 @@
         OAuthIssuer oauthIssuerImpl = new OAuthIssuerImpl(new MD5Generator());
         ClientInfo info;
         try {
-            oauthRequest = new OAuthTokenRequest(
-                    new FormRequestWrapper(request, form));
+            oauthRequest = new OAuthTokenRequest(new FormRequestWrapper(
+                    request, form));
 
-            if ((info = this.handler.getClient(oauthRequest.getClientId()))
-                    == null) {
+            if ((info = this.handler.getClient(oauthRequest.getClientId())) == null) {
                 OAuthResponse res = OAuthASResponse
                         .errorResponse(HttpServletResponse.SC_BAD_REQUEST)
                         .setError(OAuthError.TokenResponse.INVALID_CLIENT)
@@ -427,8 +447,9 @@
                         .buildJSONMessage();
                 return Response.status(res.getResponseStatus())
                         .entity(res.getBody()).build();
-            }else if (!info.getClient_secret()
-                    .equals(oauthRequest.getClientSecret())) {
+            }
+            else if (!info.getClient_secret().equals(
+                    oauthRequest.getClientSecret())) {
                 OAuthResponse res = OAuthASResponse
                         .errorResponse(HttpServletResponse.SC_UNAUTHORIZED)
                         .setError(OAuthError.TokenResponse.UNAUTHORIZED_CLIENT)
@@ -454,18 +475,21 @@
                     //can this be joined with the simple retrieval of access tokens?
                     // partially yes: auth code can be valid, even though no access token exists
                     // --> zero result set
-                    codeInfo = this.handler
-                            .getAuthorization(oauthRequest.getCode());
+                    codeInfo = this.handler.getAuthorization(oauthRequest
+                            .getCode());
                     if (codeInfo == null) {
-                        OAuthResponse res = OAuthASResponse.errorResponse(
-                                HttpServletResponse.SC_UNAUTHORIZED).setError(
-                                OAuthError.TokenResponse.INVALID_REQUEST)
+                        OAuthResponse res = OAuthASResponse
+                                .errorResponse(
+                                        HttpServletResponse.SC_UNAUTHORIZED)
+                                .setError(
+                                        OAuthError.TokenResponse.INVALID_REQUEST)
                                 .setErrorDescription(
                                         "Invalid authorization code\n")
                                 .buildJSONMessage();
                         return Response.status(res.getResponseStatus())
                                 .entity(res.getBody()).build();
-                    }else {
+                    }
+                    else {
                         openid_valid = codeInfo.getScopes().contains("openid");
                         String accessToken = oauthIssuerImpl.accessToken();
                         String refreshToken = oauthIssuerImpl.refreshToken();
@@ -475,20 +499,22 @@
                                         refreshToken, config.getTokenTTL());
 
                         builder.setTokenType(TokenType.BEARER.toString());
-                        builder.setExpiresIn(
-                                String.valueOf(config.getLongTokenTTL()));
+                        builder.setExpiresIn(String.valueOf(config
+                                .getLongTokenTTL()));
                         builder.setAccessToken(accessToken);
                         builder.setRefreshToken(refreshToken);
                     }
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
                 // todo: errors for invalid scopes or different scopes then during authorization request?
                 //todo ??
                 attr.put(Attributes.SCOPES, codeInfo.getScopes());
 
-            }else if (oauthRequest.getGrantType()
-                    .equalsIgnoreCase(GrantType.PASSWORD.toString())) {
+            }
+            else if (oauthRequest.getGrantType().equalsIgnoreCase(
+                    GrantType.PASSWORD.toString())) {
                 //fixme: via https; as basic auth header and only if client is native!
                 if (!info.isConfidential()) {
                     OAuthResponse res = OAuthASResponse
@@ -504,46 +530,47 @@
 
                 openid_valid = true;
                 try {
-                    user = controller
-                            .authenticate(0, oauthRequest.getUsername(),
-                                    oauthRequest.getPassword(), attr);
-                }catch (KustvaktException e) {
+                    user = controller.authenticate(0,
+                            oauthRequest.getUsername(),
+                            oauthRequest.getPassword(), attr);
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
 
                 try {
-                    String accessToken = this.handler
-                            .getToken(oauthRequest.getClientId(), user.getId());
+                    String accessToken = this.handler.getToken(
+                            oauthRequest.getClientId(), user.getId());
                     if (accessToken == null) {
                         String refresh = oauthIssuerImpl.refreshToken();
                         accessToken = oauthIssuerImpl.accessToken();
-                        this.handler
-                                .addToken(accessToken, refresh, user.getId(),
-                                        oauthRequest.getClientId(), StringUtils
-                                                .toString(oauthRequest
-                                                        .getScopes(), " "),
-                                        config.getLongTokenTTL());
+                        this.handler.addToken(accessToken, refresh, user
+                                .getId(), oauthRequest.getClientId(),
+                                StringUtils.toString(oauthRequest.getScopes(),
+                                        " "), config.getLongTokenTTL());
                         builder.setRefreshToken(refresh);
                     }
                     builder.setTokenType(TokenType.BEARER.toString());
-                    builder.setExpiresIn(
-                            String.valueOf(config.getLongTokenTTL()));
+                    builder.setExpiresIn(String.valueOf(config
+                            .getLongTokenTTL()));
                     builder.setAccessToken(accessToken);
 
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
             }
 
-            if (openid_valid && oauthRequest.getScopes()
-                    .contains(Scopes.Scope.openid.toString())) {
+            if (openid_valid
+                    && oauthRequest.getScopes().contains(
+                            Scopes.Scope.openid.toString())) {
                 try {
                     if (user == null)
-                        user = controller
-                                .authenticate(0, oauthRequest.getUsername(),
-                                        oauthRequest.getPassword(), attr);
-                    Userdata data = controller
-                            .getUserData(user, UserDetails.class);
+                        user = controller.authenticate(0,
+                                oauthRequest.getUsername(),
+                                oauthRequest.getPassword(), attr);
+                    Userdata data = controller.getUserData(user,
+                            UserDetails.class);
                     user.addUserData(data);
 
                     attr.put(Attributes.CLIENT_SECRET,
@@ -551,7 +578,8 @@
                     TokenContext c = controller.createTokenContext(user, attr,
                             Attributes.OPENID_AUTHENTICATION);
                     builder.setParam(c.getTokenType(), c.getToken());
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
             }
@@ -559,12 +587,14 @@
             OAuthResponse r = builder.buildJSONMessage();
             return Response.status(r.getResponseStatus()).entity(r.getBody())
                     .build();
-        }catch (OAuthProblemException ex) {
+        }
+        catch (OAuthProblemException ex) {
             OAuthResponse r = OAuthResponse.errorResponse(401).error(ex)
                     .buildJSONMessage();
             return Response.status(r.getResponseStatus()).entity(r.getBody())
                     .build();
-        }catch (OAuthSystemException e) {
+        }
+        catch (OAuthSystemException e) {
             e.printStackTrace();
             // todo: throw error
         }
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 cd10d64..73e3047 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
@@ -19,10 +19,7 @@
 import de.ids_mannheim.korap.security.ac.SecurityManager;
 import de.ids_mannheim.korap.user.TokenContext;
 import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.CollectionQueryBuilder3;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import de.ids_mannheim.korap.utils.KustvaktLogger;
-import de.ids_mannheim.korap.utils.StringUtils;
+import de.ids_mannheim.korap.utils.*;
 import de.ids_mannheim.korap.web.ClientsHandler;
 import de.ids_mannheim.korap.web.KustvaktServer;
 import de.ids_mannheim.korap.web.SearchKrill;
@@ -58,7 +55,8 @@
     private KustvaktConfiguration config;
     private RewriteHandler processor;
 
-    public ResourceService() {
+
+    public ResourceService () {
         this.controller = BeansFactory.getKustvaktContext()
                 .getAuthenticationManager();
         this.config = BeansFactory.getKustvaktContext().getConfiguration();
@@ -73,10 +71,12 @@
         this.processor.insertBeans(BeansFactory.getKustvaktContext());
     }
 
+
     /**
      * retrieve resources dependent by type. determines based on
-     * the user's permission or resource owner if the user can access the resource.
-     *
+     * the user's permission or resource owner if the user can access
+     * the resource.
+     * 
      * @param locale
      * @param context
      * @param type
@@ -84,7 +84,7 @@
      */
     @GET
     @Path("{type}")
-    public Response getResources(@Context Locale locale,
+    public Response getResources (@Context Locale locale,
             @Context SecurityContext context, @PathParam("type") String type) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         Set<KustvaktResource> resources = new HashSet<>();
@@ -97,9 +97,10 @@
         try {
             User user = controller.getUser(ctx.getUsername());
 
-            resources = ResourceFinder
-                    .search(user, ResourceFactory.getResourceClass(type));
-        }catch (KustvaktException e) {
+            resources = ResourceFinder.search(user,
+                    ResourceFactory.getResourceClass(type));
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -126,15 +127,17 @@
         return Response.ok(JsonUtils.toJSON(values)).build();
     }
 
+
     @GET
     @Path("{type}/{id}/{child}")
-    public Response getResource(@Context SecurityContext context,
+    public Response getResource (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id, @PathParam("child") String child) {
         return getResource(context, locale, type,
-                StringUtils.joinResources(id, child));
+                NamingUtils.joinResources(id, child));
     }
 
+
     /**
      * @param context
      * @param locale
@@ -144,7 +147,7 @@
      */
     @GET
     @Path("{type}/{id}")
-    public Response getResource(@Context SecurityContext context,
+    public Response getResource (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
@@ -154,19 +157,21 @@
         try {
             User user = controller.getUser(ctx.getUsername());
             if (StringUtils.isInteger(id))
-                resource = resourceHandler
-                        .findbyIntId(Integer.valueOf(id), user);
+                resource = resourceHandler.findbyIntId(Integer.valueOf(id),
+                        user);
             else
                 resource = resourceHandler.findbyStrId(id, user,
                         ResourceFactory.getResourceClass(type));
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         CollectionQueryBuilder3 query = new CollectionQueryBuilder3();
         if (cl_type.equals(VirtualCollection.class)) {
             VirtualCollection c = (VirtualCollection) resource;
             query.setBaseQuery((String) c.getData());
-        }else if (cl_type.equals(Corpus.class)) {
+        }
+        else if (cl_type.equals(Corpus.class)) {
             Corpus c = (Corpus) resource;
             query.addQuery("corpusID=" + c.getPersistentID());
         }
@@ -174,6 +179,7 @@
         return Response.ok(JsonUtils.toJSON(resource.toMap())).build();
     }
 
+
     //    @GET
     //    @Path("colloc")
     //    public Response getCollocationsAll(@Context SecurityContext ctx,
@@ -275,27 +281,30 @@
     //    }
     @POST
     @Path("colloc")
-    public Response getCollocationBase(@QueryParam("q") String query) {
+    public Response getCollocationBase (@QueryParam("q") String query) {
         String result;
         try {
             result = graphDBhandler.getResponse("distCollo", "q", query);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(result).build();
     }
 
+
     @Deprecated
-    public Response postMatchFavorite() {
+    public Response postMatchFavorite () {
         return Response.ok().build();
     }
 
+
     @TRACE
     @Path("search")
-    public Response buildQuery(@Context Locale locale,
-            @Context SecurityContext securityContext, @QueryParam("q") String q,
-            @QueryParam("ql") String ql, @QueryParam("v") String v,
-            @QueryParam("context") String context,
+    public Response buildQuery (@Context Locale locale,
+            @Context SecurityContext securityContext,
+            @QueryParam("q") String q, @QueryParam("ql") String ql,
+            @QueryParam("v") String v, @QueryParam("context") String context,
             @QueryParam("cutoff") Boolean cutoff,
             @QueryParam("count") Integer pageLength,
             @QueryParam("offset") Integer pageIndex,
@@ -316,11 +325,12 @@
                 resources = ResourceFinder.searchPublic(Corpus.class);
             else
                 resources = ResourceFinder.search(user, Corpus.class);
-            System.out.println("RESOURCES FOUND "+ resources);
+            System.out.println("RESOURCES FOUND " + resources);
 
             for (KustvaktResource corpus : resources)
                 cquery.addQuery("corpusID=" + corpus.getPersistentID());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -344,10 +354,12 @@
         return Response.ok(query).build();
     }
 
+
     /**
-     * currently only supports either no reference at all in which case all corpora are retrieved or a corpus name like "WPD".
+     * currently only supports either no reference at all in which
+     * case all corpora are retrieved or a corpus name like "WPD".
      * No virtual collections supported!
-     *
+     * 
      * @param locale
      * @param q
      * @param ql
@@ -360,10 +372,10 @@
     //todo: does cq have any sensable worth here?
     @TRACE
     @Path("{type}/{id}/search")
-    public Response buildQuery(@Context Locale locale,
-            @Context SecurityContext securityContext, @QueryParam("q") String q,
-            @QueryParam("ql") String ql, @QueryParam("v") String v,
-            @QueryParam("context") String context,
+    public Response buildQuery (@Context Locale locale,
+            @Context SecurityContext securityContext,
+            @QueryParam("q") String q, @QueryParam("ql") String ql,
+            @QueryParam("v") String v, @QueryParam("context") String context,
             @QueryParam("cutoff") Boolean cutoff,
             @QueryParam("count") Integer pageLength,
             @QueryParam("offset") Integer pageIndex,
@@ -385,8 +397,8 @@
             //todo: instead of throwing exception, build notification and rewrites into result query
             KustvaktResource resource;
             if (StringUtils.isInteger(id))
-                resource = this.resourceHandler
-                        .findbyIntId(Integer.valueOf(id), user);
+                resource = this.resourceHandler.findbyIntId(
+                        Integer.valueOf(id), user);
             else
                 resource = this.resourceHandler.findbyStrId(id, user,
                         ResourceFactory.getResourceClass(type));
@@ -396,8 +408,9 @@
             else if (resource instanceof Corpus)
                 cquery.addQuery("corpusID=" + resource.getPersistentID());
 
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             //throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -421,9 +434,10 @@
         return Response.ok(ss.toJSON()).build();
     }
 
+
     @POST
     @Path("search")
-    public Response queryRaw(@Context SecurityContext context,
+    public Response queryRaw (@Context SecurityContext context,
             @Context Locale locale, @QueryParam("engine") String engine,
             String jsonld) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
@@ -434,7 +448,8 @@
         try {
             User user = controller.getUser(ctx.getUsername());
             jsonld = this.processor.preProcess(jsonld, user);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         jlog.info("Serialized search: {}", jsonld);
@@ -444,9 +459,10 @@
         return Response.ok(result).build();
     }
 
+
     @GET
     @Path("search")
-    public Response searchbyNameAll(@Context SecurityContext securityContext,
+    public Response searchbyNameAll (@Context SecurityContext securityContext,
             @Context Locale locale, @QueryParam("q") String q,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
             @QueryParam("context") String ctx,
@@ -466,8 +482,9 @@
             Set<Corpus> resources = ResourceFinder.search(user, Corpus.class);
             for (KustvaktResource resource : resources)
                 cquery.addQuery("corpusID=" + resource.getPersistentID());
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         String result;
@@ -505,23 +522,27 @@
                     String.valueOf(meta.getSpanContext().getRight_size()));
             try {
                 result = this.graphDBhandler.getResponse(map, "distKwic");
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 throw KustvaktResponseHandler.throwit(e);
             }
-        }else
+        }
+        else
             result = searchKrill.search(query);
         KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
         return Response.ok(result).build();
     }
 
+
     /**
      * String search, String ql, List<String> parents,
      * String cli, String cri, int cls, int crs,
      * int num, int page, boolean cutoff)
      * param context will be like this: context: "3-t,2-c"
      * <p/>
-     * id does not have to be an integer. name is also possible, in which case a type reference is required
-     *
+     * id does not have to be an integer. name is also possible, in
+     * which case a type reference is required
+     * 
      * @param securityContext
      * @param locale
      * @return
@@ -529,16 +550,16 @@
     //fixme: does not use policyrewrite!
     @GET
     @Path("/{type}/{id}/search")
-    public Response searchbyName(@Context SecurityContext securityContext,
+    public Response searchbyName (@Context SecurityContext securityContext,
             @Context Locale locale, @QueryParam("q") String query,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
             @QueryParam("context") String ctx,
             @QueryParam("cutoff") Boolean cutoff,
             @QueryParam("count") Integer pageLength,
             @QueryParam("offset") Integer pageIndex,
-            @QueryParam("page") Integer pageInteger, @PathParam("id") String id,
-            @PathParam("type") String type, @QueryParam("cq") String cq,
-            @QueryParam("raw") Boolean raw,
+            @QueryParam("page") Integer pageInteger,
+            @PathParam("id") String id, @PathParam("type") String type,
+            @QueryParam("cq") String cq, @QueryParam("raw") Boolean raw,
             @QueryParam("engine") String engine) {
         // ref is a virtual collection id!
         TokenContext context = (TokenContext) securityContext
@@ -559,8 +580,8 @@
 
                 KustvaktResource resource;
                 if (StringUtils.isInteger(id))
-                    resource = this.resourceHandler
-                            .findbyIntId(Integer.valueOf(id), user);
+                    resource = this.resourceHandler.findbyIntId(
+                            Integer.valueOf(id), user);
                 else
                     resource = this.resourceHandler.findbyStrId(id, user,
                             ResourceFactory.getResourceClass(type));
@@ -570,9 +591,9 @@
                 else if (resource instanceof Corpus)
                     builder.addQuery("corpusID=" + resource.getPersistentID());
                 else
-                    throw KustvaktResponseHandler
-                            .throwit(StatusCodes.ILLEGAL_ARGUMENT,
-                                    "Type parameter not supported", type);
+                    throw KustvaktResponseHandler.throwit(
+                            StatusCodes.ILLEGAL_ARGUMENT,
+                            "Type parameter not supported", type);
 
                 meta.addEntry("startIndex", pageIndex);
                 meta.addEntry("startPage", pageInteger);
@@ -598,39 +619,42 @@
 
                 if (eng.equals(KustvaktConfiguration.BACKENDS.NEO4J)) {
                     if (raw)
-                        throw KustvaktResponseHandler
-                                .throwit(StatusCodes.ILLEGAL_ARGUMENT,
-                                        "raw not supported!", null);
+                        throw KustvaktResponseHandler.throwit(
+                                StatusCodes.ILLEGAL_ARGUMENT,
+                                "raw not supported!", null);
                     MultivaluedMap map = new MultivaluedMapImpl();
                     map.add("q", query);
                     map.add("count", String.valueOf(pageLength));
-                    map.add("lctxs", String.valueOf(
-                            meta.getSpanContext().getLeft_size()));
-                    map.add("rctxs", String.valueOf(
-                            meta.getSpanContext().getRight_size()));
+                    map.add("lctxs", String.valueOf(meta.getSpanContext()
+                            .getLeft_size()));
+                    map.add("rctxs", String.valueOf(meta.getSpanContext()
+                            .getRight_size()));
                     result = this.graphDBhandler.getResponse(map, "distKwic");
-                }else
+                }
+                else
                     result = searchKrill.search(query);
 
-            }catch (Exception e) {
-                KustvaktLogger.ERROR_LOGGER
-                        .error("Exception for serialized query: " + query, e);
+            }
+            catch (Exception e) {
+                jlog.error("Exception for serialized query: " + query, e);
                 throw KustvaktResponseHandler
                         .throwit(500, e.getMessage(), null);
             }
 
             KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
             return Response.ok(result).build();
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
     }
 
+
     @POST
     @Path("stats")
-    public Response getStats(@Context SecurityContext context,
+    public Response getStats (@Context SecurityContext context,
             @Context Locale locale, String json) {
         CollectionQueryBuilder3 builder = new CollectionQueryBuilder3();
         builder.addQuery(json);
@@ -642,18 +666,20 @@
         return Response.ok(stats).build();
     }
 
+
     @GET
     @Path("{type}/{id}/{child}/stats")
-    public Response getStatisticsbyName(@Context SecurityContext context,
+    public Response getStatisticsbyName (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id, @PathParam("child") String child) {
         return getStatisticsbyId(context, locale, type,
-                StringUtils.joinResources(id, child));
+                NamingUtils.joinResources(id, child));
     }
 
+
     @GET
     @Path("{type}/{id}/stats")
-    public Response getStatisticsbyId(@Context SecurityContext context,
+    public Response getStatisticsbyId (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
@@ -669,8 +695,8 @@
             User user = controller.getUser(ctx.getUsername());
             KustvaktResource resource;
             if (StringUtils.isInteger(id))
-                resource = this.resourceHandler
-                        .findbyIntId(Integer.valueOf(id), user);
+                resource = this.resourceHandler.findbyIntId(
+                        Integer.valueOf(id), user);
             else
                 resource = this.resourceHandler.findbyStrId(id, user,
                         ResourceFactory.getResourceClass(type));
@@ -679,18 +705,21 @@
             CollectionQueryBuilder3 query = new CollectionQueryBuilder3();
             if (resource instanceof VirtualCollection) {
                 query.setBaseQuery(resource.getData());
-            }else if (resource instanceof Corpus) {
+            }
+            else if (resource instanceof Corpus) {
                 query.addQuery("corpusID=" + resource.getName());
             }
 
             // rewrite process
             String qstr = processor.preProcess(query.toJSON(), user);
             return Response.ok(searchKrill.getStatistics(qstr)).build();
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
     }
 
+
     /**
      * @param context
      * @param locale
@@ -700,28 +729,30 @@
     //todo: rename
     @POST
     @Path("collection_raw")
-    public Response createRawCollection(@Context SecurityContext context,
+    public Response createRawCollection (@Context SecurityContext context,
             @Context Locale locale, String json) {
         TokenContext c = (TokenContext) context.getUserPrincipal();
         VirtualCollection cache = ResourceFactory.getCachedCollection(json);
         User user;
         try {
             user = controller.getUser(c.getUsername());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
 
-        VirtualCollection tmp = resourceHandler
-                .getCache(cache.getId(), VirtualCollection.class);
+        VirtualCollection tmp = resourceHandler.getCache(cache.getId(),
+                VirtualCollection.class);
         if (tmp == null) {
             CollectionQueryBuilder3 cquery = new CollectionQueryBuilder3()
                     .setBaseQuery((String) cache.getData());
-            String query = this.processor
-                    .preProcess((String) cache.getData(), user);
+            String query = this.processor.preProcess((String) cache.getData(),
+                    user);
             String stats = searchKrill.getStatistics(query);
             cache.setStats(JsonUtils.readSimple(stats, Map.class));
             resourceHandler.cache(cache);
-        }else
+        }
+        else
             cache = tmp;
 
         Map vals = new HashMap();
@@ -730,44 +761,47 @@
         return Response.ok(JsonUtils.toJSON(vals)).build();
     }
 
+
     @POST
     @Path("{type}/{id}")
-    public Response updateResource(@Context SecurityContext context,
+    public Response updateResource (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id, String json) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         User user;
         try {
             user = controller.getUser(ctx.getUsername());
-            KustvaktResource resource = this.resourceHandler
-                    .findbyStrId(id, user,
-                            ResourceFactory.getResourceClass(type));
+            KustvaktResource resource = this.resourceHandler.findbyStrId(id,
+                    user, ResourceFactory.getResourceClass(type));
             JsonNode node = JsonUtils.readTree(json);
 
             if (node.isObject() && !node.path("name").isMissingNode()) {
                 String s = node.path("name").asText();
                 if (s.equals("null") || s.isEmpty())
-                    throw KustvaktResponseHandler
-                            .throwit(StatusCodes.ILLEGAL_ARGUMENT,
-                                    "Name must be set", "name");
+                    throw KustvaktResponseHandler.throwit(
+                            StatusCodes.ILLEGAL_ARGUMENT, "Name must be set",
+                            "name");
                 resource.setName(s);
             }
 
             if (node.isObject() && !node.path("description").isMissingNode())
                 resource.setDescription(node.path("description").asText());
             this.resourceHandler.updateResources(user, resource);
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().build();
     }
 
+
     //todo: change or deprecate
     @POST
     @Path("nv/{type}")
-    public Response storeResource(@Context SecurityContext context,
-            @Context Locale locale, @PathParam("type") String type,
+    public Response storeResource (@Context SecurityContext context,
+            @Context Locale locale,
+            @PathParam("type") String type,
             @QueryParam("name") String name,
             @QueryParam("description") String description,
             // deprecate -> if you want to store a resource based on another, build the query first yourself or via a function
@@ -782,24 +816,27 @@
         User user;
         try {
             user = controller.getUser(ctx.getUsername());
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
-        if (VirtualCollection.class
-                .equals(ResourceFactory.getResourceClass(type))) {
+        if (VirtualCollection.class.equals(ResourceFactory
+                .getResourceClass(type))) {
             VirtualCollection cachetmp, collection;
 
             String base;
             if (reference != null && !reference.equals("null")) {
                 try {
-                    base = (String) resourceHandler.findbyStrId(reference, user,
-                            VirtualCollection.class).getData();
-                }catch (KustvaktException e) {
+                    base = (String) resourceHandler.findbyStrId(reference,
+                            user, VirtualCollection.class).getData();
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
 
-            }else if (query != null)
+            }
+            else if (query != null)
                 base = query;
             else
                 // todo: throw exception response for no resource to save!
@@ -811,8 +848,8 @@
             cachetmp = ResourceFactory.getCachedCollection(cquery.toJSON());
 
             // see if collection was cached!
-            VirtualCollection tmp = resourceHandler
-                    .getCache(cachetmp.getId(), VirtualCollection.class);
+            VirtualCollection tmp = resourceHandler.getCache(cachetmp.getId(),
+                    VirtualCollection.class);
             // if not cached, fill with stats values
             if (tmp == null) {
                 String stats = searchKrill.getStatistics(cquery.toJSON());
@@ -820,17 +857,18 @@
             }
 
             if (!cache) {
-                collection = ResourceFactory
-                        .getPermanentCollection(cachetmp, name, description);
+                collection = ResourceFactory.getPermanentCollection(cachetmp,
+                        name, description);
                 vals = collection.toMap();
                 try {
                     resourceHandler.storeResources(user, collection);
-                }catch (KustvaktException e) {
-                    KustvaktLogger.ERROR_LOGGER
-                            .error("Exception encountered!", e);
+                }
+                catch (KustvaktException e) {
+                    jlog.error("Exception encountered!", e);
                     throw KustvaktResponseHandler.throwit(e);
                 }
-            }else {
+            }
+            else {
                 resourceHandler.cache(cachetmp);
                 vals = cachetmp.toMap();
             }
@@ -838,9 +876,11 @@
         return Response.ok(JsonUtils.toJSON(vals)).build();
     }
 
+
     /**
-     * store a virtual collection. Retrieve cached entry first and then store VCollection
-     *
+     * store a virtual collection. Retrieve cached entry first and
+     * then store VCollection
+     * 
      * @param context
      * @param locale
      * @param query
@@ -848,7 +888,7 @@
      */
     @POST
     @Path("{type}")
-    public Response storeResource(@Context SecurityContext context,
+    public Response storeResource (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @QueryParam("filter") Boolean filter,
             @QueryParam("name") String name,
@@ -864,12 +904,13 @@
         User user;
         try {
             user = controller.getUser(ctx.getUsername());
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
-        if (VirtualCollection.class
-                .equals(ResourceFactory.getResourceClass(type))) {
+        if (VirtualCollection.class.equals(ResourceFactory
+                .getResourceClass(type))) {
 
             VirtualCollection cachetmp, collection;
             // todo: ??
@@ -877,10 +918,10 @@
             CollectionQueryBuilder3 cquery = new CollectionQueryBuilder3();
             if (reference != null && !reference.equals("null")) {
                 try {
-                    cquery.addQuery((String) resourceHandler
-                            .findbyStrId(reference, user,
-                                    VirtualCollection.class).getData());
-                }catch (KustvaktException e) {
+                    cquery.addQuery((String) resourceHandler.findbyStrId(
+                            reference, user, VirtualCollection.class).getData());
+                }
+                catch (KustvaktException e) {
                     throw KustvaktResponseHandler.throwit(e);
                 }
                 // todo: 11.01
@@ -897,8 +938,8 @@
             cachetmp = ResourceFactory.getCachedCollection(cquery.toJSON());
 
             // see if vc was cached!
-            VirtualCollection tmp = resourceHandler
-                    .getCache(cachetmp.getId(), VirtualCollection.class);
+            VirtualCollection tmp = resourceHandler.getCache(cachetmp.getId(),
+                    VirtualCollection.class);
 
             // if not cached, fill with stats values
             if (tmp == null) {
@@ -907,17 +948,18 @@
             }
 
             if (!cache && !User.UserFactory.isDemo(ctx.getUsername())) {
-                collection = ResourceFactory
-                        .getPermanentCollection(cachetmp, name, description);
+                collection = ResourceFactory.getPermanentCollection(cachetmp,
+                        name, description);
                 vals = collection.toMap();
                 try {
                     resourceHandler.storeResources(user, collection);
-                }catch (KustvaktException e) {
-                    KustvaktLogger.ERROR_LOGGER
-                            .error("Exception encountered!", e);
+                }
+                catch (KustvaktException e) {
+                    jlog.error("Exception encountered!", e);
                     throw KustvaktResponseHandler.throwit(e);
                 }
-            }else {
+            }
+            else {
                 resourceHandler.cache(cachetmp);
                 vals = cachetmp.toMap();
             }
@@ -925,18 +967,20 @@
         return Response.ok(JsonUtils.toJSON(vals)).build();
     }
 
+
     @DELETE
     @Path("{type}/{id}/{child}")
-    public Response deleteResourcewChild(@Context SecurityContext context,
+    public Response deleteResourceChild (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id, @PathParam("child") String child) {
         return deleteResource(context, locale, type,
-                StringUtils.joinResources(id, child));
+                NamingUtils.joinResources(id, child));
     }
 
+
     @DELETE
     @Path("{type}/{id}")
-    public Response deleteResource(@Context SecurityContext context,
+    public Response deleteResource (@Context SecurityContext context,
             @Context Locale locale, @PathParam("type") String type,
             @PathParam("id") String id) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
@@ -948,18 +992,20 @@
             r.setPersistentID(id);
             //todo: eliminate the need to find the resource first!
             resourceHandler.deleteResources(user, r);
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
         return Response.ok().build();
     }
 
+
     //fixme: only allowed for corpus?!
     @GET
     @Path("/corpus/{id}/{docid}/{rest}/matchInfo")
-    public Response getMatchInfo(@Context SecurityContext ctx,
+    public Response getMatchInfo (@Context SecurityContext ctx,
             @Context Locale locale, @PathParam("id") String id,
             @PathParam("docid") String docid, @PathParam("rest") String rest,
             @QueryParam("foundry") Set<String> foundries,
@@ -977,8 +1023,9 @@
         User user;
         try {
             user = controller.getUser(tokenContext.getUsername());
-        }catch (KustvaktException e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+        }
+        catch (KustvaktException e) {
+            jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
 
@@ -997,33 +1044,36 @@
                     if (!manager.isAllowed())
                         continue;
 
-                    String[] sep = StringUtils.splitAnnotations(spl);
+                    String[] sep = NamingUtils.splitAnnotations(spl);
                     if (spl != null) {
                         f_list.add(sep[0]);
                         l_list.add(sep[1]);
                     }
-                    results = searchKrill
-                            .getMatch(matchid, new ArrayList<>(f_list),
-                                    new ArrayList<>(l_list), spans, false,
-                                    true);
-                }catch (EmptyResultException e) {
-                    throw KustvaktResponseHandler
-                            .throwit(StatusCodes.EMPTY_RESULTS,
-                                    "Resource not found!", id);
-                }catch (NotAuthorizedException e) {
-                    throw KustvaktResponseHandler
-                            .throwit(StatusCodes.PERMISSION_DENIED,
-                                    "Permission denied", id);
+                    results = searchKrill.getMatch(matchid, new ArrayList<>(
+                            f_list), new ArrayList<>(l_list), spans, false,
+                            true);
+                }
+                catch (EmptyResultException e) {
+                    throw KustvaktResponseHandler.throwit(
+                            StatusCodes.EMPTY_RESULTS, "Resource not found!",
+                            id);
+                }
+                catch (NotAuthorizedException e) {
+                    throw KustvaktResponseHandler.throwit(
+                            StatusCodes.PERMISSION_DENIED, "Permission denied",
+                            id);
                 }
 
             }
             // all foundries shall be returned
-        }else if (foundries != null && foundries.contains("*")) {
+        }
+        else if (foundries != null && foundries.contains("*")) {
             Set<Layer> resources;
             try {
                 resources = ResourceFinder.search(user, Layer.class);
-            }catch (KustvaktException e) {
-                KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
+            }
+            catch (KustvaktException e) {
+                jlog.error("Exception encountered!", e);
                 throw KustvaktResponseHandler.throwit(e);
             }
             // returns foundries and layers.
@@ -1031,7 +1081,7 @@
             foundries = new HashSet<>();
             layers = new HashSet<>();
             for (Layer r : resources) {
-                String[] spl = StringUtils.splitAnnotations(r.getName());
+                String[] spl = NamingUtils.splitAnnotations(r.getName());
                 if (spl != null) {
                     foundries.add(spl[0]);
                     layers.add(spl[1]);
@@ -1045,19 +1095,21 @@
                                 new ArrayList<>(layers), spans, false, true);
             else
                 results = searchKrill.getMatch(matchid);
-        }catch (Exception e) {
-            KustvaktLogger.ERROR_LOGGER.error("Exception encountered!", e);
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.ILLEGAL_ARGUMENT, e.getMessage(), "");
+        }
+        catch (Exception e) {
+            jlog.error("Exception encountered!", e);
+            throw KustvaktResponseHandler.throwit(StatusCodes.ILLEGAL_ARGUMENT,
+                    e.getMessage(), "");
         }
         return Response.ok(results).build();
     }
 
+
     // todo:?!
     @POST
     @Path("match/{id}/save")
     @Deprecated
-    public Response save(@PathParam("{id}") String id,
+    public Response save (@PathParam("{id}") String id,
             @QueryParam("d") String description,
             @Context SecurityContext context) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
@@ -1075,28 +1127,30 @@
         return Response.ok().build();
     }
 
+
     @GET
     @Path("matches")
     @Deprecated
-    public Response get(@Context SecurityContext context) {
+    public Response get (@Context SecurityContext context) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         //todo save match for user and later retrieval!
         //todo: retrieve matches in range! --choices: date, document, id (matchid)
         return Response.ok().build();
     }
 
+
     @POST
     @Path("match/{id}/delete")
     @Deprecated
-    public Response remove(@PathParam("{id}") String id,
+    public Response remove (@PathParam("{id}") String id,
             @Context SecurityContext context) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         // save match for user and later retrieval!
         try {
-            this.resourceHandler
-                    .deleteResources(this.controller.getUser(ctx.getUsername()),
-                            id);
-        }catch (KustvaktException e) {
+            this.resourceHandler.deleteResources(
+                    this.controller.getUser(ctx.getUsername()), id);
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
 
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 45999fc..9273171 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
@@ -40,26 +40,27 @@
     private static Logger jlog = LoggerFactory.getLogger(UserService.class);
     private AuthenticationManagerIface controller;
 
-    private
-    @Context
+    private @Context
     UriInfo info;
 
-    public UserService() {
+
+    public UserService () {
         this.controller = BeansFactory.getKustvaktContext()
                 .getAuthenticationManager();
     }
 
+
     // fixme: json contains password in clear text. Encrypt request?
     // fixme: should also collect service exception, not just db exception!
     @POST
     @Path("register")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response signUp(
+    public Response signUp (
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host,
             @Context Locale locale, MultivaluedMap form_values) {
-        Map<String, Object> wrapper = FormRequestWrapper
-                .toMap(form_values, true);
+        Map<String, Object> wrapper = FormRequestWrapper.toMap(form_values,
+                true);
 
         wrapper.put(Attributes.HOST, host);
         wrapper.put(Attributes.USER_AGENT, agent);
@@ -71,15 +72,15 @@
                     .path("confirm");
 
             user = controller.createUserAccount(wrapper, true);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         URIParam uri = user.getField(URIParam.class);
         if (uri.hasValues()) {
             uriBuilder.queryParam(Attributes.QUERY_PARAM_URI,
-                    uri.getUriFragment())
-                    .queryParam(Attributes.QUERY_PARAM_USER,
-                            user.getUsername());
+                    uri.getUriFragment()).queryParam(
+                    Attributes.QUERY_PARAM_USER, user.getUsername());
             jlog.info("registration was successful for user '{}'",
                     form_values.get(Attributes.USERNAME));
             Map object = new HashMap();
@@ -87,7 +88,8 @@
             object.put("uri_expiration",
                     TimeUtils.format(uri.getUriExpiration()));
             return Response.ok(JsonUtils.toJSON(object)).build();
-        }else {
+        }
+        else {
             // todo: return error or warning
             throw KustvaktResponseHandler.throwit(StatusCodes.ILLEGAL_ARGUMENT,
                     "failed to validate uri paramter", "confirmation fragment");
@@ -95,13 +97,14 @@
 
     }
 
+
     //todo: password update in special function? --> password reset only!
     @POST
     @Path("update")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response updateAccount(@Context SecurityContext ctx, String json) {
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response updateAccount (@Context SecurityContext ctx, String json) {
         TokenContext context = (TokenContext) ctx.getUserPrincipal();
         try {
             User user = controller.getUser(context.getUsername());
@@ -113,41 +116,43 @@
             //                    .checkPasswordAllowance(ident, values.getPassword(),
             //                            node.path("new_password").asText());
             //            controller.updateAccount(user);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().build();
     }
 
+
     @GET
     @Path("confirm")
     @Produces(MediaType.TEXT_HTML)
-    public Response confirmRegistration(@QueryParam("uri") String uritoken,
+    public Response confirmRegistration (@QueryParam("uri") String uritoken,
             @Context Locale locale, @QueryParam("user") String username) {
         if (uritoken == null || uritoken.isEmpty())
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.ILLEGAL_ARGUMENT, "parameter missing",
-                            "uri parameter");
+            throw KustvaktResponseHandler.throwit(StatusCodes.ILLEGAL_ARGUMENT,
+                    "parameter missing", "uri parameter");
         if (username == null || username.isEmpty())
-            throw KustvaktResponseHandler
-                    .throwit(StatusCodes.ILLEGAL_ARGUMENT, "parameter missing",
-                            "Username");
+            throw KustvaktResponseHandler.throwit(StatusCodes.ILLEGAL_ARGUMENT,
+                    "parameter missing", "Username");
 
         try {
             controller.confirmRegistration(uritoken, username);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok("success").build();
     }
 
+
     // todo: auditing!
     @POST
     @Path("requestReset")
     @Produces(MediaType.TEXT_HTML)
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response requestPasswordReset(@Context Locale locale, String json) {
+    public Response requestPasswordReset (@Context Locale locale, String json) {
         JsonNode node = JsonUtils.readTree(json);
         StringBuilder builder = new StringBuilder();
         String username, email;
@@ -173,7 +178,8 @@
                     .append(objects[0]);
             builder.append(Attributes.QUERY_PARAM_USER).append("=")
                     .append(username);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Eoxception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
@@ -184,28 +190,31 @@
         return Response.ok(JsonUtils.toJSON(obj)).build();
     }
 
+
     @POST
     @Path("reset")
     @Produces(MediaType.TEXT_HTML)
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response resetPassword(
+    public Response resetPassword (
             @QueryParam(Attributes.QUERY_PARAM_URI) String uri,
             @QueryParam(Attributes.QUERY_PARAM_USER) String username,
             @Context HttpHeaders headers, String passphrase) {
         try {
             controller.resetPassword(uri, username, passphrase);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             return Response.notModified().build();
         }
         return Response.ok().build();
     }
 
+
     @GET
     @Path("info")
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response getStatus(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response getStatus (@Context SecurityContext context,
             @QueryParam("scopes") String scopes) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         Scopes m;
@@ -218,17 +227,19 @@
                 base_scope.retainAll(StringUtils.toSet(scopes));
             scopes = StringUtils.toString(base_scope);
             m = Scopes.mapScopes(scopes, data.fields());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(m.toEntity()).build();
     }
 
+
     @GET
     @Path("settings")
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response getUserSettings(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response getUserSettings (@Context SecurityContext context,
             @Context Locale locale) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         String result;
@@ -237,20 +248,22 @@
             Userdata data = controller.getUserData(user, UserSettings.class);
             data.setField(Attributes.USERNAME, ctx.getUsername());
             result = data.data();
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(result).build();
     }
 
+
     // todo: test
     @POST
     @Path("settings")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response updateSettings(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response updateSettings (@Context SecurityContext context,
             @Context Locale locale, MultivaluedMap form) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         Map<String, Object> settings = FormRequestWrapper.toMap(form, false);
@@ -272,7 +285,8 @@
             data.update(new_data);
 
             controller.updateUserData(data);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
@@ -280,11 +294,12 @@
         return Response.ok().build();
     }
 
+
     @GET
     @Path("details")
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response getDetails(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response getDetails (@Context SecurityContext context,
             @Context Locale locale) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         String result;
@@ -293,19 +308,21 @@
             Userdata data = controller.getUserData(user, UserDetails.class);
             data.setField(Attributes.USERNAME, ctx.getUsername());
             result = data.data();
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(result).build();
     }
 
+
     @POST
     @Path("details")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response updateDetails(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response updateDetails (@Context SecurityContext context,
             @Context Locale locale, MultivaluedMap form) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
 
@@ -322,7 +339,8 @@
             UserDetails det = controller.getUserData(user, UserDetails.class);
             det.update(new_data);
             controller.updateUserData(det);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
@@ -330,14 +348,14 @@
         return Response.ok().build();
     }
 
+
     //fixme: if policy allows, foreign user might be allowed to change search!
     @POST
     @Path("queries")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response updateQueries(@Context SecurityContext context,
-            String json) {
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response updateQueries (@Context SecurityContext context, String json) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         Collection<UserQuery> add = new HashSet<>();
         try {
@@ -377,35 +395,39 @@
             //                resourceHandler.deleteResources(user,
             //                        resources.toArray(new UserQuery[resources.size()]));
             //            }
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(JsonUtils.toJSON(add)).build();
     }
 
+
     @DELETE
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response deleteUser(@Context SecurityContext context) {
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response deleteUser (@Context SecurityContext context) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         try {
             User user = controller.getUser(ctx.getUsername());
             if (User.UserFactory.isDemo(ctx.getUsername()))
                 return Response.notModified().build();
             controller.deleteAccount(user);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok().build();
     }
 
+
     @GET
     @Path("queries")
-    @ResourceFilters({ AuthFilter.class, DefaultFilter.class, PiwikFilter.class,
-            BlockingFilter.class })
-    public Response getQueries(@Context SecurityContext context,
+    @ResourceFilters({ AuthFilter.class, DefaultFilter.class,
+            PiwikFilter.class, BlockingFilter.class })
+    public Response getQueries (@Context SecurityContext context,
             @Context Locale locale) {
         TokenContext ctx = (TokenContext) context.getUserPrincipal();
         String queryStr;
@@ -416,7 +438,8 @@
             //            queryStr = JsonUtils.toJSON(queries);
             //todo:
             queryStr = "";
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             jlog.error("Exception encountered!", e);
             throw KustvaktResponseHandler.throwit(e);
         }
diff --git a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
index 783e7e2..1d7e556 100644
--- a/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
+++ b/src/main/java/de/ids_mannheim/korap/web/service/light/LightService.java
@@ -43,7 +43,8 @@
     private RewriteHandler processor;
     private KustvaktConfiguration config;
 
-    public LightService() {
+
+    public LightService () {
         this.config = BeansFactory.getKustvaktContext().getConfiguration();
         this.searchKrill = new SearchKrill(config.getIndexDir());
         UriBuilder builder = UriBuilder.fromUri("http://10.0.10.13").port(9997);
@@ -53,38 +54,42 @@
         this.processor.insertBeans(BeansFactory.getKustvaktContext());
     }
 
+
     /**
      * @param query
      * @return response
      */
     @POST
     @Path("colloc")
-    public Response getCollocationBase(@QueryParam("q") String query) {
+    public Response getCollocationBase (@QueryParam("q") String query) {
         String result;
         try {
             result = graphDBhandler.getResponse("distCollo", "q", query);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             throw KustvaktResponseHandler.throwit(e);
         }
         return Response.ok(result).build();
     }
 
+
     // todo
     @Deprecated
-    public Response postMatchFavorite() {
+    public Response postMatchFavorite () {
         return Response.ok().build();
     }
 
+
     @TRACE
     @Path("search")
-    public Response buildQuery(@QueryParam("q") String q,
+    public Response buildQuery (@QueryParam("q") String q,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
             @QueryParam("context") String context,
             @QueryParam("cutoff") Boolean cutoff,
             @QueryParam("count") Integer pageLength,
             @QueryParam("offset") Integer pageIndex,
             @QueryParam("page") Integer startPage,
-                               // fixme: remove cq from light service
+            // fixme: remove cq from light service
             @QueryParam("cq") String cq) {
         QuerySerializer ss = new QuerySerializer().setQuery(q, ql, v);
 
@@ -101,10 +106,10 @@
         return Response.ok(processor.preProcess(ss.toJSON(), null)).build();
     }
 
+
     @POST
     @Path("search")
-    public Response queryRaw(@QueryParam("engine") String engine,
-            String jsonld) {
+    public Response queryRaw (@QueryParam("engine") String engine, String jsonld) {
         jsonld = processor.preProcess(jsonld, null);
         // todo: should be possible to add the meta part to the query serialization
         jlog.info("Serialized search: {}", jsonld);
@@ -114,9 +119,10 @@
         return Response.ok(result).build();
     }
 
+
     @GET
     @Path("search")
-    public Response searchbyNameAll(@QueryParam("q") String q,
+    public Response searchbyNameAll (@QueryParam("q") String q,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
             @QueryParam("context") String ctx,
             @QueryParam("cutoff") Boolean cutoff,
@@ -124,15 +130,14 @@
             @QueryParam("offset") Integer pageIndex,
             @QueryParam("page") Integer pageInteger,
             @QueryParam("fields") Set<String> fields,
-                                    // fixme: remove cq value from lightservice
+            // fixme: remove cq value from lightservice
             @QueryParam("cq") String cq, @QueryParam("engine") String engine) {
         KustvaktConfiguration.BACKENDS eng = this.config.chooseBackend(engine);
 
         String result;
         QuerySerializer serializer = new QuerySerializer().setQuery(q, ql, v);
-        MetaQueryBuilder meta = QueryBuilderUtil
-                .defaultMetaBuilder(pageIndex, pageInteger, pageLength, ctx,
-                        cutoff);
+        MetaQueryBuilder meta = QueryBuilderUtil.defaultMetaBuilder(pageIndex,
+                pageInteger, pageLength, ctx, cutoff);
         if (fields != null && !fields.isEmpty())
             meta.addEntry("fields", fields);
         serializer.setMeta(meta);
@@ -154,20 +159,24 @@
 
             try {
                 result = this.graphDBhandler.getResponse(map, "distKwic");
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 throw KustvaktResponseHandler.throwit(e);
             }
-        }else
+        }
+        else
             result = searchKrill.search(query);
         KustvaktLogger.QUERY_LOGGER.trace("The result set: {}", result);
         return Response.ok(result).build();
     }
 
+
     /**
      * param context will be like this: context: "3-t,2-c"
      * <p/>
-     * id does not have to be an integer. name is also possible, in which case a type reference is required
-     *
+     * id does not have to be an integer. name is also possible, in
+     * which case a type reference is required
+     * 
      * @param query
      * @param ql
      * @param v
@@ -186,7 +195,7 @@
     //fixme: search in collection /collection/collection-id/search
     @GET
     @Path("/{type}/{id}/search")
-    public Response searchbyName(@PathParam("id") String id,
+    public Response searchbyName (@PathParam("id") String id,
             @PathParam("type") String type, @QueryParam("q") String query,
             @QueryParam("ql") String ql, @QueryParam("v") String v,
             @QueryParam("context") String ctx,
@@ -199,9 +208,8 @@
         // ref is a virtual collection id!
         KustvaktConfiguration.BACKENDS eng = this.config.chooseBackend(engine);
         raw = raw == null ? false : raw;
-        MetaQueryBuilder meta = QueryBuilderUtil
-                .defaultMetaBuilder(pageIndex, pageInteger, pageLength, ctx,
-                        cutoff);
+        MetaQueryBuilder meta = QueryBuilderUtil.defaultMetaBuilder(pageIndex,
+                pageInteger, pageLength, ctx, cutoff);
         if (!raw) {
             // should only apply to CQL queries
             //                meta.addEntry("itemsPerResource", 1);
@@ -213,9 +221,9 @@
         try {
             if (eng.equals(KustvaktConfiguration.BACKENDS.NEO4J)) {
                 if (raw)
-                    throw KustvaktResponseHandler
-                            .throwit(StatusCodes.ILLEGAL_ARGUMENT,
-                                    "raw not supported!", null);
+                    throw KustvaktResponseHandler.throwit(
+                            StatusCodes.ILLEGAL_ARGUMENT, "raw not supported!",
+                            null);
                 MultivaluedMap map = new MultivaluedMapImpl();
                 map.add("q", query);
                 map.add("count", String.valueOf(pageLength));
@@ -224,12 +232,13 @@
                 map.add("rctxs",
                         String.valueOf(meta.getSpanContext().getRight_size()));
                 result = this.graphDBhandler.getResponse(map, "distKwic");
-            }else
+            }
+            else
                 result = searchKrill.search(query);
 
-        }catch (Exception e) {
-            KustvaktLogger.ERROR_LOGGER
-                    .error("Exception for serialized query: " + query, e);
+        }
+        catch (Exception e) {
+            jlog.error("Exception for serialized query: " + query, e);
             throw KustvaktResponseHandler.throwit(500, e.getMessage(), null);
         }
 
@@ -237,10 +246,11 @@
         return Response.ok(result).build();
     }
 
+
     //todo: switch to new serialization
     @POST
     @Path("stats")
-    public Response getStats(String json) {
+    public Response getStats (String json) {
         CollectionQueryBuilder3 builder = new CollectionQueryBuilder3();
         builder.addQuery(json);
 
@@ -252,9 +262,10 @@
         return Response.ok(stats).build();
     }
 
+
     @GET
     @Path("/corpus/{id}/{docid}/{rest}/matchInfo")
-    public Response getMatchInfo(@PathParam("id") String id,
+    public Response getMatchInfo (@PathParam("id") String id,
             @PathParam("docid") String docid, @PathParam("rest") String rest,
             @QueryParam("foundry") Set<String> foundries,
             @QueryParam("layer") Set<String> layers,
@@ -265,8 +276,8 @@
         if (layers != null && !layers.isEmpty())
             l_list = new ArrayList<>(layers);
 
-        if (foundries != null && !foundries.isEmpty() && !foundries
-                .contains("*"))
+        if (foundries != null && !foundries.isEmpty()
+                && !foundries.contains("*"))
             f_list = new ArrayList<>(foundries);
 
         boolean match_only = foundries == null || foundries.isEmpty();
@@ -274,8 +285,8 @@
         if (match_only)
             results = searchKrill.getMatch(matchid);
         else
-            results = searchKrill
-                    .getMatch(matchid, f_list, l_list, spans, false, true);
+            results = searchKrill.getMatch(matchid, f_list, l_list, spans,
+                    false, true);
 
         return Response.ok(results).build();
     }
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 f486b1b..b17ed94 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
@@ -8,9 +8,10 @@
 import java.util.Map;
 
 /**
- * Helper class to wrapp multivaluedmap into a hashmap. Depending on the strict parameter,
+ * Helper class to wrapp multivaluedmap into a hashmap. Depending on
+ * the strict parameter,
  * list values are retained in the resulting wrapper map.
- *
+ * 
  * @author hanl
  * @date 25/04/2015
  */
@@ -18,28 +19,32 @@
 
     private MultivaluedMap<String, Object> form;
 
+
     /**
      * Constructs a request object wrapping the given request.
-     *
+     * 
      * @param request
-     * @throws IllegalArgumentException if the request is null
+     * @throws IllegalArgumentException
+     *             if the request is null
      */
-    public FormRequestWrapper(HttpServletRequest request,
-            MultivaluedMap<String, Object> form) {
+    public FormRequestWrapper (HttpServletRequest request,
+                               MultivaluedMap<String, Object> form) {
         super(request);
         this.form = form;
     }
 
+
     @Override
-    public String getParameter(String name) {
+    public String getParameter (String name) {
         String value = super.getParameter(name);
         if (value == null)
             value = String.valueOf(form.getFirst(name));
         return value;
     }
 
+
     @Override
-    public String[] getParameterValues(String name) {
+    public String[] getParameterValues (String name) {
         String[] values = super.getParameterValues(name);
         if (values == null && form.get(name) != null) {
             values = new String[form.get(name).size()];
@@ -48,17 +53,21 @@
         return values;
     }
 
-    public Map<String, Object> singleValueMap() {
+
+    public Map<String, Object> singleValueMap () {
         return toMap(this.form, false);
     }
 
+
     /**
-     * @param strict returns only values with size equal to one. If false pairs key to first value
-     *               in value list and returns the result
+     * @param strict
+     *            returns only values with size equal to one. If false
+     *            pairs key to first value
+     *            in value list and returns the result
      * @return key/value map
      */
-    public static Map<String, Object> toMap(MultivaluedMap<String, Object> form,
-            boolean strict) {
+    public static Map<String, Object> toMap (
+            MultivaluedMap<String, Object> form, boolean strict) {
         HashMap<String, Object> map = new HashMap<>();
         for (String key : form.keySet()) {
             if (strict && form.get(key).size() > 1)
@@ -69,14 +78,14 @@
         return map;
     }
 
-    public void put(String key, String value) {
+
+    public void put (String key, String value) {
         this.form.putSingle(key, value);
     }
 
-    public void put(String key, String... values) {
-        this.form.put(key, Arrays.<Object>asList(values));
+
+    public void put (String key, String ... values) {
+        this.form.put(key, Arrays.<Object> asList(values));
     }
 
 }
-
-
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java b/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java
index f6da418..543fbae 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/HTMLBuilder.java
@@ -10,7 +10,8 @@
     private StringBuilder body;
     private String bodyAttr;
 
-    public HTMLBuilder() {
+
+    public HTMLBuilder () {
         html = new StringBuilder();
         body = new StringBuilder();
         bodyAttr = "";
@@ -18,22 +19,25 @@
     }
 
 
-    public void addHeader(String header, int h) {
+    public void addHeader (String header, int h) {
         html.append("<h" + h + ">");
         html.append(header);
         html.append("</h" + h + ">");
     }
 
-    public void addToBody(String body) {
+
+    public void addToBody (String body) {
         this.body.append(body);
     }
 
-    public void addToBody(String body, String attributes) {
+
+    public void addToBody (String body, String attributes) {
         this.body.append(body);
         bodyAttr = attributes;
     }
 
-    public String build() {
+
+    public String build () {
         if (bodyAttr.isEmpty())
             html.append("<body>");
         else {
@@ -50,7 +54,7 @@
 
 
     @Override
-    public String toString() {
+    public String toString () {
         return build();
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java b/src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java
index e341c14..2424d4b 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/KorAPContext.java
@@ -8,35 +8,40 @@
 /**
  * @author hanl
  * @date 13/05/2014
- *
- * wrapper for REST security context
- *
+ * 
+ *       wrapper for REST security context
+ * 
  */
 public class KorAPContext implements SecurityContext {
 
     private TokenContext user;
 
-    public KorAPContext(final TokenContext user) {
+
+    public KorAPContext (final TokenContext user) {
         this.user = user;
     }
 
+
     @Override
-    public Principal getUserPrincipal() {
+    public Principal getUserPrincipal () {
         return this.user;
     }
 
+
     @Override
-    public boolean isUserInRole(String role) {
+    public boolean isUserInRole (String role) {
         throw new UnsupportedOperationException();
     }
 
+
     @Override
-    public boolean isSecure() {
+    public boolean isSecure () {
         return false;
     }
 
+
     @Override
-    public String getAuthenticationScheme() {
+    public String getAuthenticationScheme () {
         return SecurityContext.BASIC_AUTH;
     }
 }
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktMap.java b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktMap.java
index c6b618a..d657149 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktMap.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktMap.java
@@ -13,26 +13,31 @@
     private boolean mono;
     private Map<String, Object> values;
 
-    public KustvaktMap() {
+
+    public KustvaktMap () {
         this.values = new HashMap<>();
         this.mono = false;
     }
 
-    public KustvaktMap(Map<String, Object> m) {
+
+    public KustvaktMap (Map<String, Object> m) {
         this();
         setMap(m);
     }
 
-    public void setMap(Map<String, Object> m) {
+
+    public void setMap (Map<String, Object> m) {
         if (!isGeneric(m) | !this.mono)
             this.values.putAll(m);
     }
 
-    public boolean isGeneric() {
+
+    public boolean isGeneric () {
         return !this.mono && isGeneric(this.values);
     }
 
-    private static boolean isGeneric(Map<String, Object> map) {
+
+    private static boolean isGeneric (Map<String, Object> map) {
         int i = 0;
         for (Object o : map.values()) {
             if (o instanceof String)
@@ -41,28 +46,33 @@
         return !(i == map.size());
     }
 
-    public void setMonoValue(boolean monovalue) {
+
+    public void setMonoValue (boolean monovalue) {
         this.mono = monovalue;
     }
 
-    public String get(String key) {
+
+    public String get (String key) {
         Object o = this.values.get(key);
         if (!isGeneric())
             return (String) o;
         return String.valueOf(o);
     }
 
-    public Object getRaw(String key) {
+
+    public Object getRaw (String key) {
         return this.values.get(key);
     }
 
-    public <T extends Object> Object get(String key, Class<T> cl) {
+
+    public <T extends Object> Object get (String key, Class<T> cl) {
         if (isGeneric())
             return (T) this.values.get(key);
         return get(key);
     }
 
-    public Set<String> keySet() {
+
+    public Set<String> keySet () {
         return this.values.keySet();
     }
 
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java
index bd4c675..6b66d54 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/KustvaktResponseHandler.java
@@ -19,58 +19,67 @@
 
     private static AuditingIface auditing;
 
-    public static void init(AuditingIface iface) {
+
+    public static void init (AuditingIface iface) {
         if (auditing == null)
             auditing = iface;
     }
 
-    private static void register(List<AuditRecord> records) {
+
+    private static void register (List<AuditRecord> records) {
         if (auditing != null && !records.isEmpty())
             auditing.audit(records);
         else if (auditing == null)
             throw new RuntimeException("Auditing handler must be set!");
     }
 
-    public static WebApplicationException throwit(KustvaktException e) {
+
+    public static WebApplicationException throwit (KustvaktException e) {
         Response s = Response.status(getStatus(e.getStatusCode()))
                 .entity(buildNotification(e)).build();
         return new WebApplicationException(s);
     }
 
-    public static WebApplicationException throwit(int code) {
+
+    public static WebApplicationException throwit (int code) {
         return new WebApplicationException(Response.status(getStatus(code))
                 .entity(buildNotification(code, "", "")).build());
     }
 
-    public static WebApplicationException throwit(int code, String message,
+
+    public static WebApplicationException throwit (int code, String message,
             String entity) {
         return new WebApplicationException(Response.status(getStatus(code))
                 .entity(buildNotification(code, message, entity)).build());
     }
 
-    private static String buildNotification(KustvaktException e) {
+
+    private static String buildNotification (KustvaktException e) {
         register(e.getRecords());
         return buildNotification(e.getStatusCode(), e.getMessage(),
                 e.getEntity());
     }
 
-    public static String buildNotification(int code, String message,
+
+    public static String buildNotification (int code, String message,
             String entity) {
         Notifications notif = new Notifications();
         notif.addError(code, message, entity);
         return notif.toJsonString() + "\n";
     }
 
-    public static WebApplicationException throwAuthenticationException() {
-        return new WebApplicationException(
-                Response.status(Response.Status.UNAUTHORIZED)
-                        .header(HttpHeaders.WWW_AUTHENTICATE,
-                                "Basic realm=Kustvakt Authentication Service")
-                        .entity(buildNotification(StatusCodes.BAD_CREDENTIALS,
-                                "Unauthorized access", "")).build());
+
+    public static WebApplicationException throwAuthenticationException () {
+        return new WebApplicationException(Response
+                .status(Response.Status.UNAUTHORIZED)
+                .header(HttpHeaders.WWW_AUTHENTICATE,
+                        "Basic realm=Kustvakt Authentication Service")
+                .entity(buildNotification(StatusCodes.BAD_CREDENTIALS,
+                        "Unauthorized access", "")).build());
     }
 
-    private static Response.Status getStatus(int code) {
+
+    private static Response.Status getStatus (int code) {
         Response.Status status = Response.Status.BAD_REQUEST;
         switch (code) {
             case StatusCodes.EMPTY_RESULTS:
diff --git a/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java b/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
index 47e8e03..cb76260 100644
--- a/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
+++ b/src/main/java/de/ids_mannheim/korap/web/utils/LocaleProvider.java
@@ -18,28 +18,30 @@
  * @date 04/02/2014
  */
 @Provider
-public class LocaleProvider
-        extends AbstractHttpContextInjectable<Locale>
+public class LocaleProvider extends AbstractHttpContextInjectable<Locale>
         implements InjectableProvider<Context, Type> {
 
     @Override
-    public Locale getValue(HttpContext httpContext) {
-        final List<Locale> locales = httpContext.getRequest().getAcceptableLanguages();
+    public Locale getValue (HttpContext httpContext) {
+        final List<Locale> locales = httpContext.getRequest()
+                .getAcceptableLanguages();
         if (locales.isEmpty())
             return Locale.US;
         return locales.get(0);
     }
 
+
     @Override
-    public ComponentScope getScope() {
+    public ComponentScope getScope () {
         return ComponentScope.PerRequest;
     }
 
+
     @Override
-    public Injectable getInjectable(ComponentContext ic, Context context, Type type) {
+    public Injectable getInjectable (ComponentContext ic, Context context,
+            Type type) {
         if (type.equals(Locale.class))
             return this;
         return null;
     }
 }
-
diff --git a/src/test/java/CollectionQueryBuilderTest.java b/src/test/java/CollectionQueryBuilderTest.java
index ab9706a..0840e20 100644
--- a/src/test/java/CollectionQueryBuilderTest.java
+++ b/src/test/java/CollectionQueryBuilderTest.java
@@ -15,33 +15,36 @@
 public class CollectionQueryBuilderTest {
 
     @Test
-    public void testsimpleAdd() {
+    public void testsimpleAdd () {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
         b.addQuery("corpusID=WPD");
 
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
         assertNotNull(node);
-        assertEquals("koral:doc",node.at("/collection/@type").asText());
-        assertEquals("corpusID",node.at("/collection/key").asText());
+        assertEquals("koral:doc", node.at("/collection/@type").asText());
+        assertEquals("corpusID", node.at("/collection/key").asText());
     }
 
+
     @Test
-    public void testSimpleConjunction() {
+    public void testSimpleConjunction () {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
         b.addQuery("corpusID=WPD & textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
         assertNotNull(node);
-        assertEquals("koral:docGroup",node.at("/collection/@type").asText());
-        assertEquals("operation:and",node.at("/collection/operation").asText());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals("operation:and", node.at("/collection/operation").asText());
 
-        assertEquals("corpusID",node.at("/collection/operands/0/key").asText());
-        assertEquals("textClass",node.at("/collection/operands/1/key").asText());
+        assertEquals("corpusID", node.at("/collection/operands/0/key").asText());
+        assertEquals("textClass", node.at("/collection/operands/1/key")
+                .asText());
     }
 
+
     @Test
-    public void testSimpleDisjunction() {
+    public void testSimpleDisjunction () {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
         b.addQuery("corpusID=WPD | textClass=freizeit");
         JsonNode node = JsonUtils.readTree(b.toJSON());
@@ -57,15 +60,15 @@
                 .equals("textClass");
     }
 
+
     @Test
-    public void testComplexSubQuery() {
+    public void testComplexSubQuery () {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
-        b.addQuery(
-                "(corpusID=WPD) | (textClass=freizeit & corpusID=WPD)");
+        b.addQuery("(corpusID=WPD) | (textClass=freizeit & corpusID=WPD)");
         JsonNode node = JsonUtils.readTree(b.toJSON());
 
-        System.out.println(
-                "_____________________________________________ COMPLEX");
+        System.out
+                .println("_____________________________________________ COMPLEX");
         System.out.println(node);
         assert node != null;
         assert node.at("/collection/operation").asText().equals("operation:or");
@@ -76,8 +79,9 @@
 
     }
 
+
     @Test
-    public void testAddResourceQueryAfter() {
+    public void testAddResourceQueryAfter () {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
         b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
 
@@ -94,8 +98,9 @@
                 .equals("wissenschaft");
     }
 
+
     @Test
-    public void testAddComplexResourceQueryAfter() {
+    public void testAddComplexResourceQueryAfter () {
         CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
         b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
 
@@ -115,8 +120,9 @@
 
     }
 
+
     @Test
-    public void buildQuery() {
+    public void buildQuery () {
         String query = "[base=Haus]";
         QuerySerializer s = new QuerySerializer();
         s.setQuery(query, "poliqarp");
@@ -127,8 +133,9 @@
         System.out.println("QUERY " + s.toJSON());
     }
 
+
     @Test
-    public void testBaseQueryBuild() {
+    public void testBaseQueryBuild () {
 
     }
 
diff --git a/src/test/java/FileAuditingTest.java b/src/test/java/FileAuditingTest.java
index fecc338..9804107 100644
--- a/src/test/java/FileAuditingTest.java
+++ b/src/test/java/FileAuditingTest.java
@@ -15,22 +15,24 @@
 public class FileAuditingTest extends BeanConfigTest {
 
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 
+
     @Test
-    public void testAdd() {
+    public void testAdd () {
         for (int i = 0; i < 20; i++) {
-            AuditRecord record = AuditRecord
-                    .serviceRecord("MichaelHanl", StatusCodes.ILLEGAL_ARGUMENT,
-                            String.valueOf(i), "string value");
+            AuditRecord record = AuditRecord.serviceRecord("MichaelHanl",
+                    StatusCodes.ILLEGAL_ARGUMENT, String.valueOf(i),
+                    "string value");
             helper().getContext().getAuditingProvider().audit(record);
         }
     }
 
+
     @Test(expected = UnsupportedOperationException.class)
-    public void testRetrieval() {
+    public void testRetrieval () {
         helper().getContext().getAuditingProvider()
                 .retrieveRecords(new LocalDate(new Date().getTime()), 10);
     }
diff --git a/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
index b40b8c7..0f95b20 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
@@ -17,29 +17,31 @@
 public class ClassLoaderTest extends BeanConfigTest {
 
     @Test
-    public void testDefaultCreationThrowsNoException() {
+    public void testDefaultCreationThrowsNoException () {
         DefaultHandler pl = new DefaultHandler();
         Object o = pl.getDefault(ContextHolder.KUSTVAKT_AUDITING);
         assertNotNull(o);
         assertTrue(o instanceof AuditingIface);
     }
 
+
     @Test
-    public void testDefaultCreation2ThrowsNoException() {
+    public void testDefaultCreation2ThrowsNoException () {
         AuthenticationManagerIface iface = helper().getContext()
                 .getAuthenticationManager();
         assertNotNull(iface);
         assertTrue(iface instanceof KustvaktAuthenticationManager);
     }
 
+
     @Test
-    public void testDefaultInterfaceMatchThrowsNoException() {
+    public void testDefaultInterfaceMatchThrowsNoException () {
         AuditingIface iface = helper().getContext().getAuditingProvider();
         assertNotNull(iface);
         assertTrue(iface instanceof JDBCAuditing);
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
-    }
+    public void initMethod () throws KustvaktException {}
 }
diff --git a/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
index d3bffd4..6f0ee8b 100644
--- a/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
@@ -14,9 +14,9 @@
 public class CollectionLoaderTest extends BeanConfigTest {
 
     @Test
-    public void testCollectionLoader() {
-        ResourceDao dao = new ResourceDao(
-                helper().getContext().getPersistenceClient());
+    public void testCollectionLoader () {
+        ResourceDao dao = new ResourceDao(helper().getContext()
+                .getPersistenceClient());
 
         boolean error = false;
         UserLoader u = new UserLoader();
@@ -24,15 +24,17 @@
         try {
             u.load(helper().getContext());
             l.load(helper().getContext());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             error = true;
         }
         Assert.assertFalse(error);
         Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
index d9e28e3..fe2201f 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -20,35 +20,40 @@
 public class ConfigTest extends BeanConfigTest {
 
     @Test
-    public void testServiceInfo() {
+    public void testServiceInfo () {
         String version = ServiceInfo.getInfo().getVersion();
         String name = ServiceInfo.getInfo().getName();
         assertNotEquals("wrong version", "UNKNOWN", version);
         assertNotEquals("wrong name", "UNKNOWN", name);
     }
 
+
     @Test
-    public void testProperties() {
-        assertEquals("token layer does not match", "opennlp",
-                helper().getContext().getConfiguration().getDefault_token());
+    public void testProperties () {
+        assertEquals("token layer does not match", "opennlp", helper()
+                .getContext().getConfiguration().getDefault_token());
         assertEquals("token expiration does not match",
-                TimeUtils.convertTimeToSeconds("1D"),
-                helper().getContext().getConfiguration().getLongTokenTTL());
+                TimeUtils.convertTimeToSeconds("1D"), helper().getContext()
+                        .getConfiguration().getLongTokenTTL());
     }
 
+
     @Test(expected = KustvaktException.class)
-    public void testBeanOverrideInjection() throws KustvaktException {
-        helper().getContext().getConfiguration().setPropertiesAsStream(
-                ConfigTest.class.getClassLoader()
-                        .getResourceAsStream("kustvakt.conf"));
+    public void testBeanOverrideInjection () throws KustvaktException {
+        helper().getContext()
+                .getConfiguration()
+                .setPropertiesAsStream(
+                        ConfigTest.class.getClassLoader().getResourceAsStream(
+                                "kustvakt.conf"));
 
         String v = "testmail_&234@ids-mannheim.de";
         helper().getContext().getEncryption()
                 .validateEntry(v, Attributes.EMAIL);
     }
 
+
     @Test
-    public void testBootConfigRun() {
+    public void testBootConfigRun () {
         helper().runBootInterfaces();
         helper().setupAccount();
         assertNotNull(helper().getUser());
@@ -64,14 +69,14 @@
             try {
                 iface = (BootableBeanInterface) cl.newInstance();
                 list.add(iface);
-            }catch (InstantiationException | IllegalAccessException e) {
+            }
+            catch (InstantiationException | IllegalAccessException e) {
                 // do nothing
             }
         }
 
         while (!set.isEmpty()) {
-            out_loop:
-            for (BootableBeanInterface iface : new ArrayList<>(list)) {
+            out_loop: for (BootableBeanInterface iface : new ArrayList<>(list)) {
                 for (Class cl : iface.getDependencies()) {
                     if (set.contains(cl))
                         continue out_loop;
@@ -84,16 +89,16 @@
         assertEquals(check, tracker.size());
     }
 
+
     @Test
-    public void testBootConfigDependencyOrder() {
+    public void testBootConfigDependencyOrder () {
         // todo:
 
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 }
-
-
diff --git a/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
index a9270d2..3d3f8f7 100644
--- a/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
@@ -17,7 +17,7 @@
 public class PolicyLoaderTest extends BeanConfigTest {
 
     @Test
-    public void testPolicyLoader() {
+    public void testPolicyLoader () {
         boolean error = false;
         UserLoader u = new UserLoader();
         CollectionLoader c = new CollectionLoader();
@@ -26,17 +26,20 @@
             u.load(helper().getContext());
             c.load(helper().getContext());
             l.load(helper().getContext());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
             error = true;
         }
         assertFalse(error);
-        PolicyDao dao = new PolicyDao(helper().getContext().getPersistenceClient());
+        PolicyDao dao = new PolicyDao(helper().getContext()
+                .getPersistenceClient());
         assertNotEquals("Is not supposed to be zero", 0, dao.size());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestBeans.java b/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
index 6961289..7d33ba2 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
@@ -15,24 +15,33 @@
 
     protected PersistenceClient dataSource;
 
-    public abstract PolicyHandlerIface getPolicyDao();
 
-    public abstract KustvaktConfiguration getConfig();
+    public abstract PolicyHandlerIface getPolicyDao ();
 
-    public abstract EntityHandlerIface getUserDao();
 
-    public abstract AuditingIface getAuditingDao();
+    public abstract KustvaktConfiguration getConfig ();
 
-    public abstract List<ResourceOperationIface> getResourceDaos();
 
-    public abstract List<UserDataDbIface> getUserdataDaos();
+    public abstract EntityHandlerIface getUserDao ();
 
-    public abstract EncryptionIface getCrypto();
 
-    public abstract AuthenticationManagerIface getAuthManager();
+    public abstract AuditingIface getAuditingDao ();
+
+
+    public abstract List<ResourceOperationIface> getResourceDaos ();
+
+
+    public abstract List<UserDataDbIface> getUserdataDaos ();
+
+
+    public abstract EncryptionIface getCrypto ();
+
+
+    public abstract AuthenticationManagerIface getAuthManager ();
+
 
     @Bean(name = "kustvakt_db")
-    public PersistenceClient getDataSource() {
+    public PersistenceClient getDataSource () {
         return this.dataSource;
     }
 }
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 607cc71..0746293 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -39,7 +39,7 @@
 
 /**
  * creates a test user that can be used to access protected functions
- *
+ * 
  * @author hanl
  * @date 16/10/2015
  */
@@ -51,37 +51,41 @@
 
     private ContextHolder beansHolder;
 
-    public static TestHelper newInstance(ApplicationContext ctx)
+
+    public static TestHelper newInstance (ApplicationContext ctx)
             throws Exception {
         TestHelper b = new TestHelper();
-        b.beansHolder = new ContextHolder(ctx) {
-        };
+        b.beansHolder = new ContextHolder(ctx) {};
         return b;
     }
 
-    public <T> T getBean(Class<T> type) {
+
+    public <T> T getBean (Class<T> type) {
         return this.beansHolder.getBean(type);
     }
 
-    public ContextHolder getContext() {
+
+    public ContextHolder getContext () {
         return this.beansHolder;
     }
 
-    public <T> T getBean(String name) {
+
+    public <T> T getBean (String name) {
         return (T) this.beansHolder.getBean(name);
     }
 
-    public TestHelper setupAccount() {
+
+    public TestHelper setupAccount () {
         KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
 
-        KustvaktAuthenticationManager manager = getBean(
-                ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER);
+        KustvaktAuthenticationManager manager = getBean(ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER);
 
         try {
             getUser();
             System.out.println("found user, skipping setup ...");
             return this;
-        }catch (RuntimeException e) {
+        }
+        catch (RuntimeException e) {
             // do nothing and continue
         }
 
@@ -101,7 +105,8 @@
 
         try {
             manager.createUserAccount(m, false);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             // do nothing
             e.printStackTrace();
             assertNotNull("Test user could not be set up", null);
@@ -110,7 +115,8 @@
         return this;
     }
 
-    public TestHelper setupSimpleAccount(String username, String password) {
+
+    public TestHelper setupSimpleAccount (String username, String password) {
         KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
 
         if (dao.size() == 0) {
@@ -118,11 +124,12 @@
             m.put(Attributes.USERNAME, username);
 
             try {
-                String hash = ((EncryptionIface) getBean(
-                        ContextHolder.KUSTVAKT_ENCRYPTION))
+                String hash = ((EncryptionIface) getBean(ContextHolder.KUSTVAKT_ENCRYPTION))
                         .produceSecureHash(password);
                 m.put(Attributes.PASSWORD, hash);
-            }catch (NoSuchAlgorithmException | UnsupportedEncodingException | KustvaktException e) {
+            }
+            catch (NoSuchAlgorithmException | UnsupportedEncodingException
+                    | KustvaktException e) {
                 // do nohting
                 assertNotNull("Exception thrown", null);
             }
@@ -134,7 +141,8 @@
                 assert BeansFactory.getKustvaktContext().getUserDBHandler()
                         .getAccount(credentials[0]) != null;
                 assert i == 1;
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 // do nothing
                 Assert.assertNull("Test user could not be set up", true);
             }
@@ -142,20 +150,22 @@
         return this;
     }
 
-    public User getUser() {
+
+    public User getUser () {
         try {
             return ((EntityHandlerIface) getBean(ContextHolder.KUSTVAKT_USERDB))
                     .getAccount(credentials[0]);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             // do nothing
         }
         throw new RuntimeException("User could not be retrieved!");
     }
 
-    public TestHelper dropUser(String... usernames) throws KustvaktException {
+
+    public TestHelper dropUser (String ... usernames) throws KustvaktException {
         if (usernames == null || usernames.length == 0) {
-            KustvaktBaseDaoInterface dao = getBean(
-                    ContextHolder.KUSTVAKT_USERDB);
+            KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
             dao.truncate();
         }
         for (String name : Arrays.asList(usernames)) {
@@ -165,14 +175,16 @@
         return this;
     }
 
-    private boolean remove(String username) throws KustvaktException {
+
+    private boolean remove (String username) throws KustvaktException {
         EntityHandlerIface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
         User us = dao.getAccount(username);
         dao.deleteAccount(us.getId());
         return true;
     }
 
-    public TestHelper truncateAll() {
+
+    public TestHelper truncateAll () {
         String sql = "SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES";
         final Set<String> queries = new HashSet<>();
         PersistenceClient cl = getBean(ContextHolder.KUSTVAKT_POLICIES);
@@ -181,7 +193,7 @@
 
         source.query(sql, new RowCallbackHandler() {
             @Override
-            public void processRow(ResultSet rs) throws SQLException {
+            public void processRow (ResultSet rs) throws SQLException {
                 queries.add(rs.getString(1));
 
             }
@@ -192,11 +204,13 @@
         return this;
     }
 
-    public static final String[] getUserCredentials() {
+
+    public static final String[] getUserCredentials () {
         return Arrays.copyOf(credentials, 2);
     }
 
-    public TestHelper runBootInterfaces() {
+
+    public TestHelper runBootInterfaces () {
         Set<Class<? extends BootableBeanInterface>> set = KustvaktClassLoader
                 .loadSubTypes(BootableBeanInterface.class);
 
@@ -206,18 +220,17 @@
             try {
                 iface = (BootableBeanInterface) cl.newInstance();
                 list.add(iface);
-            }catch (InstantiationException | IllegalAccessException e) {
+            }
+            catch (InstantiationException | IllegalAccessException e) {
                 // do nothing
             }
         }
         System.out.println("Found boot loading interfaces: " + list);
         while (!set.isEmpty()) {
-            out_loop:
-            for (BootableBeanInterface iface : new ArrayList<>(list)) {
+            out_loop: for (BootableBeanInterface iface : new ArrayList<>(list)) {
                 try {
-                    System.out.println(
-                            "Running boot instructions from class " + iface
-                                    .getClass().getSimpleName());
+                    System.out.println("Running boot instructions from class "
+                            + iface.getClass().getSimpleName());
                     for (Class cl : iface.getDependencies()) {
                         if (set.contains(cl))
                             continue out_loop;
@@ -225,11 +238,11 @@
                     set.remove(iface.getClass());
                     list.remove(iface);
                     iface.load(beansHolder);
-                }catch (KustvaktException e) {
+                }
+                catch (KustvaktException e) {
                     // don't do anything!
-                    System.out.println(
-                            "An error occurred in class " + iface.getClass()
-                                    .getSimpleName() + "!\n" + e);
+                    System.out.println("An error occurred in class "
+                            + iface.getClass().getSimpleName() + "!\n" + e);
                     throw new RuntimeException(
                             "Boot loading interface failed ...");
                 }
@@ -238,24 +251,27 @@
         return this;
     }
 
-    public int setupResource(KustvaktResource resource)
+
+    public int setupResource (KustvaktResource resource)
             throws KustvaktException {
         ResourceDao dao = new ResourceDao(
                 (PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
         return dao.storeResource(resource, getUser());
     }
 
-    public KustvaktResource getResource(String name) throws KustvaktException {
+
+    public KustvaktResource getResource (String name) throws KustvaktException {
         ResourceDao dao = new ResourceDao(
                 (PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
         KustvaktResource res = dao.findbyId(name, getUser());
         if (res == null)
-            throw new RuntimeException(
-                    "resource with name " + name + " not found ...");
+            throw new RuntimeException("resource with name " + name
+                    + " not found ...");
         return res;
     }
 
-    public TestHelper dropResource(String... names) throws KustvaktException {
+
+    public TestHelper dropResource (String ... names) throws KustvaktException {
         ResourceDao dao = new ResourceDao(
                 (PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
         if (names == null || names.length == 0)
@@ -265,15 +281,18 @@
         return this;
     }
 
-    public void close() {
+
+    public void close () {
         BeansFactory.closeApplication();
     }
 
-    private TestHelper() {
+
+    private TestHelper () {
 
     }
 
-    private static PersistenceClient mysql_db() throws IOException {
+
+    private static PersistenceClient mysql_db () throws IOException {
         BasicDataSource dataSource = new BasicDataSource();
         dataSource.setDriverClassName("com.mysql.jdbc.Driver");
         dataSource.setUrl("jdbc:mysql://localhost:3306/kustvakt_test");
@@ -290,7 +309,8 @@
         return client;
     }
 
-    private static PersistenceClient sqlite_db(Class testclass, boolean memory)
+
+    private static PersistenceClient sqlite_db (Class testclass, boolean memory)
             throws InterruptedException {
         SingleConnectionDataSource dataSource = new SingleConnectionDataSource();
         dataSource.setDriverClassName("org.sqlite.JDBC");
@@ -303,8 +323,8 @@
             File tmp = new File("tmp");
             if (!tmp.exists())
                 tmp.mkdirs();
-            dataSource.setUrl("jdbc:sqlite:tmp/sqlite_" + name +
-                    t.getMillis() + ".sqlite");
+            dataSource.setUrl("jdbc:sqlite:tmp/sqlite_" + name + t.getMillis()
+                    + ".sqlite");
         }
         dataSource.setSuppressClose(true);
 
@@ -318,7 +338,8 @@
         return client;
     }
 
-    public static PersistenceClient sqlite_db_norm(boolean memory) {
+
+    public static PersistenceClient sqlite_db_norm (boolean memory) {
         BasicDataSource dataSource = new BasicDataSource();
         dataSource.setDriverClassName("org.sqlite.JDBC");
         dataSource.setMaxTotal(1);
@@ -345,7 +366,8 @@
         return client;
     }
 
-    public static PersistenceClient h2_emb() throws SQLException {
+
+    public static PersistenceClient h2_emb () throws SQLException {
         BasicDataSource dataSource = new BasicDataSource();
         dataSource.setUrl("jdbc:h2:mem:");
         dataSource.getConnection().nativeSQL("SET MODE MySQL;");
@@ -365,26 +387,29 @@
 
     public static class AppTestConfig extends TestBeans {
 
-        public AppTestConfig() throws InterruptedException, IOException {
+        public AppTestConfig () throws InterruptedException, IOException {
             this.dataSource = TestHelper.sqlite_db(TestHelper.clazz, false);
             //this.dataSource = TestHelper.mysql_db();
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_POLICIES)
         @Override
-        public PolicyHandlerIface getPolicyDao() {
+        public PolicyHandlerIface getPolicyDao () {
             return new PolicyDao(this.dataSource);
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_USERDB)
         @Override
-        public EntityHandlerIface getUserDao() {
+        public EntityHandlerIface getUserDao () {
             return new EntityDao(this.dataSource);
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_CONFIG)
         @Override
-        public KustvaktConfiguration getConfig() {
+        public KustvaktConfiguration getConfig () {
             KustvaktConfiguration c = new KustvaktConfiguration();
             InputStream s = TestHelper.class.getClassLoader()
                     .getResourceAsStream("kustvakt.conf");
@@ -397,39 +422,44 @@
             return c;
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_AUDITING)
         @Override
-        public AuditingIface getAuditingDao() {
+        public AuditingIface getAuditingDao () {
             return new JDBCAuditing(this.dataSource);
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_RESOURCES)
         @Override
-        public List<ResourceOperationIface> getResourceDaos() {
+        public List<ResourceOperationIface> getResourceDaos () {
             List<ResourceOperationIface> res = new ArrayList<>();
             res.add(new ResourceDao(getDataSource()));
             res.add(new DocumentDao(getDataSource()));
             return res;
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_USERDATA)
         @Override
-        public List<UserDataDbIface> getUserdataDaos() {
+        public List<UserDataDbIface> getUserdataDaos () {
             List<UserDataDbIface> ud = new ArrayList<>();
             ud.add(new UserSettingsDao(getDataSource()));
             ud.add(new UserDetailsDao(getDataSource()));
             return ud;
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_ENCRYPTION)
         @Override
-        public EncryptionIface getCrypto() {
+        public EncryptionIface getCrypto () {
             return new KustvaktEncryption(getConfig());
         }
 
+
         @Bean(name = ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER)
         @Override
-        public AuthenticationManagerIface getAuthManager() {
+        public AuthenticationManagerIface getAuthManager () {
             AuthenticationManagerIface manager = new KustvaktAuthenticationManager(
                     getUserDao(), getCrypto(), getConfig(), getAuditingDao(),
                     getUserdataDaos());
diff --git a/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
index 4e28c4d..91ad661 100644
--- a/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
@@ -13,14 +13,16 @@
 public class UserLoaderTest extends BeanConfigTest {
 
     @Test
-    public void testUserLoader() {
-        EntityDao dao = new EntityDao(helper().getContext().getPersistenceClient());
+    public void testUserLoader () {
+        EntityDao dao = new EntityDao(helper().getContext()
+                .getPersistenceClient());
 
         boolean error = false;
         UserLoader l = new UserLoader();
         try {
             l.load(helper().getContext());
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
             error = true;
         }
@@ -28,8 +30,9 @@
         Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
index 9a13eb4..b3387c6 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
@@ -17,33 +17,38 @@
 
     private static DocumentDao dao;
 
+
     @After
-    public void clear() {
+    public void clear () {
         dao.truncate();
     }
 
+
     @Test
-    public void testSet() throws KustvaktException {
+    public void testSet () throws KustvaktException {
         Document doc = new Document("BRZ13_APR.00001");
         doc.setDisabled(true);
         dao.storeResource(doc, null);
     }
 
+
     @Test
-    public void testGet() {
+    public void testGet () {
         Document doc = new Document("BRZ13_APR.00002");
         doc.setDisabled(true);
         try {
             dao.storeResource(doc, null);
             Document doc1 = dao.findbyId(doc.getPersistentID(), null);
             assert doc1 != null && doc.isDisabled();
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
         }
     }
 
+
     @Test
-    public void testRemove() {
+    public void testRemove () {
         Document doc = new Document("BRZ13_APR.00003");
         doc.setDisabled(true);
         try {
@@ -52,18 +57,21 @@
             assert dao.deleteResource(doc.getPersistentID(), null) == 1;
             doc1 = dao.findbyId(doc.getPersistentID(), null);
             assert doc1 == null;
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
 
         }
     }
 
+
     @Test
-    public void testEmptyFind() {
+    public void testEmptyFind () {
         List<String> dc = null;
         try {
             dc = dao.findbyCorpus("WPD", true);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
         }
 
@@ -71,15 +79,17 @@
         Assert.assertEquals("should be empty", 0, dc.size());
     }
 
+
     @Test
-    public void testFind() {
+    public void testFind () {
         int length = 10;
         for (int i = 0; i < length; i++) {
             Document doc = new Document("WPD_APR.0000" + i);
             doc.setDisabled(true);
             try {
                 dao.storeResource(doc, null);
-            }catch (KustvaktException e) {
+            }
+            catch (KustvaktException e) {
                 e.printStackTrace();
                 break;
             }
@@ -88,7 +98,8 @@
         List<String> dc = null;
         try {
             dc = dao.findbyCorpus("WPD", true);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
         }
 
@@ -97,8 +108,9 @@
         Assert.assertEquals("not all found", length, dc.size());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         dao = new DocumentDao(helper().getContext().getPersistenceClient());
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
index 20825a7..04d3eef 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
@@ -25,8 +25,9 @@
 
     private static List<Integer> ids = new ArrayList<>();
 
+
     @Override
-    public void initMethod() {
+    public void initMethod () {
         helper().setupAccount();
 
         List classes = new ArrayList<>(
@@ -40,41 +41,48 @@
                 r.setPersistentID(r.getName());
                 int id = helper().setupResource(r);
                 ids.add(id);
-                assertNotEquals(0,
-                        new ResourceDao<>(helper().getContext().getPersistenceClient())
-                                .size());
-            }catch (InstantiationException e) {
+                assertNotEquals(0, new ResourceDao<>(helper().getContext()
+                        .getPersistenceClient()).size());
+            }
+            catch (InstantiationException e) {
                 if (i < classes.size())
                     classes.remove(i);
-            }catch (KustvaktException | IllegalAccessException e) {
+            }
+            catch (KustvaktException | IllegalAccessException e) {
                 e.printStackTrace();
             }
         }
     }
 
+
     @Test
-    public void testBatchGetResources() throws KustvaktException {
-        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+    public void testBatchGetResources () throws KustvaktException {
+        ResourceDao dao = new ResourceDao(helper().getContext()
+                .getPersistenceClient());
         assertNotEquals(0, dao.size());
         Collection res = dao.getResources(ids, User.UserFactory.getDemoUser());
         assertEquals(ids.size(), res.size());
     }
 
+
     @Test
-    public void testGetResource() throws KustvaktException {
-        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
-        assertEquals("sqlite",
-                helper().getContext().getPersistenceClient().getDatabase());
+    public void testGetResource () throws KustvaktException {
+        ResourceDao dao = new ResourceDao(helper().getContext()
+                .getPersistenceClient());
+        assertEquals("sqlite", helper().getContext().getPersistenceClient()
+                .getDatabase());
 
         assertNotEquals(0, dao.size());
-        KustvaktResource res = dao
-                .findbyId(ids.get(0), User.UserFactory.getDemoUser());
+        KustvaktResource res = dao.findbyId(ids.get(0),
+                User.UserFactory.getDemoUser());
         assertNotNull(res);
     }
 
+
     @Test
-    public void createCollection() throws KustvaktException {
-        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+    public void createCollection () throws KustvaktException {
+        ResourceDao dao = new ResourceDao(helper().getContext()
+                .getPersistenceClient());
         VirtualCollection c = new VirtualCollection("testColl1");
         c.addField("key_1", "this is a test");
         c.addField("key_2", 2);
@@ -85,15 +93,17 @@
         int id = dao.storeResource(c, user);
 
         KustvaktResource r = dao.findbyId(id, user);
-        assertNotEquals(dao.size(),0);
+        assertNotEquals(dao.size(), 0);
         assertNotNull(r);
-        assertEquals(r.getField("key_1") instanceof String,true);
-        assertEquals(r.getField("key_2") instanceof Integer,true);
+        assertEquals(r.getField("key_1") instanceof String, true);
+        assertEquals(r.getField("key_2") instanceof Integer, true);
     }
 
+
     @Test
-    public void ResourceDataUpdate() throws KustvaktException {
-        ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+    public void ResourceDataUpdate () throws KustvaktException {
+        ResourceDao dao = new ResourceDao(helper().getContext()
+                .getPersistenceClient());
         VirtualCollection c = new VirtualCollection("testColl2");
         c.addField("key_1", "this is a test");
         c.addField("key_2", 2);
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
index 0c9be7c..d3bdc84 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
@@ -24,53 +24,58 @@
 public class UserDaoTest extends BeanConfigTest {
 
     @Test
-    public void userput() throws KustvaktException {
+    public void userput () throws KustvaktException {
         User user1 = helper().getContext().getUserDBHandler()
                 .getAccount(TestHelper.getUserCredentials()[0]);
         assertEquals("user creation failed", true, user1.getId() != -1);
     }
 
+
     @Test
-    public void userputBatch() {
+    public void userputBatch () {
         //todo:
     }
 
+
     @Test
-    public void userget() throws KustvaktException {
+    public void userget () throws KustvaktException {
         User user1 = helper().getContext().getUserDBHandler()
                 .getAccount(TestHelper.getUserCredentials()[0]);
         assertEquals("User Retrieval does not work",
                 TestHelper.getUserCredentials()[0], user1.getUsername());
     }
 
+
     //    @Test
-    public void testUserdetailsGetNonExistent() throws KustvaktException {
+    public void testUserdetailsGetNonExistent () throws KustvaktException {
         helper().setupSimpleAccount("userdbtest", "userdbTest");
         User user = helper().getContext().getUserDBHandler()
                 .getAccount("userdbtest");
-        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(helper()
-                .getContext().getUserDataDaos(), UserDetails.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), UserDetails.class);
         Userdata data = dao.get(user);
         assertNull(data);
         helper().dropUser("userdbtest");
     }
 
+
     //    @Test
-    public void testUserSettingsGetNonExistent() throws KustvaktException {
+    public void testUserSettingsGetNonExistent () throws KustvaktException {
         helper().setupSimpleAccount("userdbtest", "userdbTest");
         User user = helper().getContext().getUserDBHandler()
                 .getAccount("userdbtest");
-        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(helper()
-                .getContext().getUserDataDaos(), UserSettings.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), UserSettings.class);
         Userdata data = dao.get(user);
         assertNull(data);
         helper().dropUser("userdbtest");
 
     }
 
+
     // username cannot currently be changed
     //    @Test
-    public void updateUsername() throws KustvaktException {
+    public void updateUsername () throws KustvaktException {
         User user1 = helper().getContext().getUserDBHandler()
                 .getAccount(TestHelper.getUserCredentials()[0]);
         user1.setUsername("new_user");
@@ -80,18 +85,20 @@
         assertEquals("not found", user1.getUsername(), u2.getUsername());
     }
 
+
     @Test
-    public void userupdate() throws KustvaktException {
+    public void userupdate () throws KustvaktException {
         EntityHandlerIface dao = helper().getContext().getUserDBHandler();
         User user1 = dao.getAccount(TestHelper.getUserCredentials()[0]);
         user1.setAccountLocked(true);
         dao.updateAccount(user1);
-        assertEquals("not valid", true,
-                dao.getAccount(user1.getUsername()).isAccountLocked());
+        assertEquals("not valid", true, dao.getAccount(user1.getUsername())
+                .isAccountLocked());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
         helper().runBootInterfaces();
     }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
index 6574d09..0c7035b 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
@@ -26,14 +26,16 @@
 
     private static KustvaktConfiguration config;
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         config = helper().getContext().getConfiguration();
     }
 
+
     @Deprecated
     @Test
-    public void test2() {
+    public void test2 () {
         Pattern p = Pattern.compile("([\\.\\w]+)\\((.+)\\)");
         String cl = de.ids_mannheim.korap.security.ac.SecurityManager.class
                 .getCanonicalName();
@@ -43,8 +45,9 @@
 
     }
 
+
     @Test
-    public void testCollectionNodeRemoveCorpusIdNoErrors() {
+    public void testCollectionNodeRemoveCorpusIdNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
@@ -58,8 +61,9 @@
         assertEquals(1, node.at("/collection/operands").size());
     }
 
+
     @Test
-    public void testCollectionNodeRemoveAllCorpusIdNoErrors() {
+    public void testCollectionNodeRemoveAllCorpusIdNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
@@ -74,49 +78,54 @@
         assertEquals(0, node.at("/collection/operands").size());
     }
 
+
     @Test
-    public void testCollectionNodeRemoveGroupedCorpusIdNoErrors() {
+    public void testCollectionNodeRemoveGroupedCorpusIdNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(corpusID=BRZ13 & textClass=Wissenschaft) & corpusID=WPD");
+        s.setCollection("(corpusID=BRZ13 & textClass=Wissenschaft) & corpusID=WPD");
         String result = s.toJSON();
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
 
         assertNotNull(node);
-        assertEquals("koral:docGroup",node.at("/collection/operands/0/@type").asText());
-        assertEquals("textClass",node.at("/collection/operands/0/operands/0/key").asText());
+        assertEquals("koral:docGroup", node.at("/collection/operands/0/@type")
+                .asText());
+        assertEquals("textClass",
+                node.at("/collection/operands/0/operands/0/key").asText());
     }
 
+
     //fixme: will probably fail when one doc groups are being refactored
     @Test
-    public void testCollectionCleanEmptyDocGroupNoErrors() {
+    public void testCollectionCleanEmptyDocGroupNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft & textClass=Sport");
+        s.setCollection("(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft & textClass=Sport");
         String result = s.toJSON();
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
 
         assertNotNull(node);
-        assertEquals("koral:docGroup",node.at("/collection/@type").asText());
-        assertEquals(2,node.at("/collection/operands").size());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+        assertEquals(2, node.at("/collection/operands").size());
 
-        assertEquals("textClass",node.at("/collection/operands/0/key").asText());
-        assertEquals("textClass",node.at("/collection/operands/1/key").asText());
+        assertEquals("textClass", node.at("/collection/operands/0/key")
+                .asText());
+        assertEquals("textClass", node.at("/collection/operands/1/key")
+                .asText());
     }
 
+
     @Test
-    public void testCollectionCleanMoveOneDocFromGroupUpNoErrors() {
+    public void testCollectionCleanMoveOneDocFromGroupUpNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
@@ -128,46 +137,47 @@
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
         assertNotNull(node);
-        assertEquals("koral:doc",node.at("/collection/@type").asText());
+        assertEquals("koral:doc", node.at("/collection/@type").asText());
     }
 
+
     @Test
-    public void testCollectionCleanEmptyGroupAndMoveOneFromGroupUpNoErrors() {
+    public void testCollectionCleanEmptyGroupAndMoveOneFromGroupUpNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft");
+        s.setCollection("(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft");
         String result = s.toJSON();
         JsonNode node = JsonUtils.readTree(handler.preProcess(result,
                 User.UserFactory.getUser("test_user")));
 
         assertNotNull(node);
-        assertEquals("koral:doc",node.at("/collection/@type").asText());
-        assertEquals("textClass",node.at("/collection/key").asText());
+        assertEquals("koral:doc", node.at("/collection/@type").asText());
+        assertEquals("textClass", node.at("/collection/key").asText());
     }
 
+
     @Test
-    public void testCollectionRemoveAndMoveOneFromGroupUpNoErrors() {
+    public void testCollectionRemoveAndMoveOneFromGroupUpNoErrors () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         handler.add(CollectionConstraint.class);
         handler.add(CollectionCleanupFilter.class);
         QuerySerializer s = new QuerySerializer();
         s.setQuery(simple_add_query, "poliqarp");
-        s.setCollection(
-                "(docID=random & textClass=Wissenschaft) & corpusID=WPD");
+        s.setCollection("(docID=random & textClass=Wissenschaft) & corpusID=WPD");
         String org = s.toJSON();
         JsonNode node = JsonUtils.readTree(handler.preProcess(org,
                 User.UserFactory.getUser("test_user")));
 
         assertNotNull(node);
-        assertEquals("koral:docGroup",node.at("/collection/@type").asText());
+        assertEquals("koral:docGroup", node.at("/collection/@type").asText());
         assertEquals(2, node.at("/collection/operands").size());
-        assertEquals("koral:doc",node.at("/collection/operands/0/@type").asText());
+        assertEquals("koral:doc", node.at("/collection/operands/0/@type")
+                .asText());
     }
 
 
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
index 0cbd369..cb7d38d 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
@@ -32,14 +32,16 @@
 
     private static KustvaktConfiguration config;
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         config = helper().getContext().getConfiguration();
         helper().setupAccount();
     }
 
+
     @Test
-    public void testDefaultLayerMapperThrowsNoException() {
+    public void testDefaultLayerMapperThrowsNoException () {
         LayerMapper m = new LayerMapper(config);
 
         assertEquals(config.getDefault_lemma(), m.findFoundry("lemma"));
@@ -49,11 +51,12 @@
         assertEquals(config.getDefault_const(), m.findFoundry("c"));
     }
 
-    @Test
-    public void testDefaultFoundryInjectLemmaThrowsNoError() {
 
-        KustvaktConfiguration c = helper()
-                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+    @Test
+    public void testDefaultFoundryInjectLemmaThrowsNoError () {
+
+        KustvaktConfiguration c = helper().getBean(
+                ContextHolder.KUSTVAKT_CONFIG);
 
         RewriteHandler processor = new RewriteHandler();
         processor.insertBeans(helper().getContext());
@@ -65,19 +68,20 @@
 
         assertNotNull(node);
         assertFalse(node.at("/query/wrap/foundry").isMissingNode());
-        assertEquals(c.getDefault_lemma(),
-                node.at("/query/wrap/foundry").asText());
+        assertEquals(c.getDefault_lemma(), node.at("/query/wrap/foundry")
+                .asText());
         assertEquals("lemma", node.at("/query/wrap/layer").asText());
         assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
-        assertEquals("koral:rewrite",
-                node.at("/query/wrap/rewrites/0/@type").asText());
+        assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+                .asText());
     }
 
-    @Test
-    public void testDefaultFoundryInjectPOSNoErrors() {
 
-        KustvaktConfiguration c = helper()
-                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+    @Test
+    public void testDefaultFoundryInjectPOSNoErrors () {
+
+        KustvaktConfiguration c = helper().getBean(
+                ContextHolder.KUSTVAKT_CONFIG);
 
         QuerySerializer s = new QuerySerializer();
         RewriteHandler handler = new RewriteHandler();
@@ -89,17 +93,18 @@
 
         assertNotNull(node);
         assertFalse(node.at("/query/wrap/foundry").isMissingNode());
-        assertEquals(c.getDefault_pos(),
-                node.at("/query/wrap/foundry").asText());
+        assertEquals(c.getDefault_pos(), node.at("/query/wrap/foundry")
+                .asText());
         assertEquals("pos", node.at("/query/wrap/layer").asText());
         assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
-        assertEquals("koral:rewrite",
-                node.at("/query/wrap/rewrites/0/@type").asText());
+        assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+                .asText());
 
     }
 
+
     @Test
-    public void testRewriteFoundryInjectPOSThrowsNoError()
+    public void testRewriteFoundryInjectPOSThrowsNoError ()
             throws KustvaktException {
         User user = helper().getUser();
 
@@ -111,9 +116,8 @@
         String result = handler.preProcess(s.toJSON(), user);
         JsonNode node = JsonUtils.readTree(result);
 
-        UserDataDbIface dao = BeansFactory.getTypeFactory()
-                .getTypedBean(helper().getContext().getUserDataDaos(),
-                        UserSettings.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), UserSettings.class);
         UserSettings settings = (UserSettings) dao.get(user);
         assertTrue(settings.isValid());
         String pos = (String) settings.get(Attributes.DEFAULT_POS_FOUNDRY);
@@ -122,15 +126,16 @@
         assertEquals("pos", node.at("/query/wrap/layer").asText());
         assertEquals(pos, node.at("/query/wrap/foundry").asText());
         assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
-        assertEquals("koral:rewrite",
-                node.at("/query/wrap/rewrites/0/@type").asText());
+        assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+                .asText());
     }
 
+
     @Test
-    public void testRewriteFoundryInjectLemmaThrowsNoError()
+    public void testRewriteFoundryInjectLemmaThrowsNoError ()
             throws KustvaktException {
-        KustvaktConfiguration c = helper()
-                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+        KustvaktConfiguration c = helper().getBean(
+                ContextHolder.KUSTVAKT_CONFIG);
         User user = helper().getUser();
 
         RewriteHandler handler = new RewriteHandler();
@@ -141,9 +146,8 @@
         String result = handler.preProcess(s.toJSON(), user);
         JsonNode node = JsonUtils.readTree(result);
 
-        UserDataDbIface dao = BeansFactory.getTypeFactory()
-                .getTypedBean(helper().getContext().getUserDataDaos(),
-                        UserSettings.class);
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), UserSettings.class);
         UserSettings settings = (UserSettings) dao.get(user);
         assertTrue(settings.isValid());
         String lemma = (String) settings.get(Attributes.DEFAULT_LEMMA_FOUNDRY);
@@ -152,14 +156,15 @@
         assertEquals("lemma", node.at("/query/wrap/layer").asText());
         assertEquals(lemma, node.at("/query/wrap/foundry").asText());
         assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
-        assertEquals("koral:rewrite",
-                node.at("/query/wrap/rewrites/0/@type").asText());
+        assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+                .asText());
     }
 
+
     @Test
-    public void testFoundryInjectJoinedQueryNoErrors() {
-        KustvaktConfiguration c = helper()
-                .getBean(ContextHolder.KUSTVAKT_CONFIG);
+    public void testFoundryInjectJoinedQueryNoErrors () {
+        KustvaktConfiguration c = helper().getBean(
+                ContextHolder.KUSTVAKT_CONFIG);
 
         QuerySerializer s = new QuerySerializer();
         RewriteHandler handler = new RewriteHandler();
@@ -177,8 +182,9 @@
         assertFalse(node.at("/query/wrap/operands/1/rewrites").isMissingNode());
     }
 
+
     @Test
-    public void testFoundryInjectGroupedQueryNoErrors() {
+    public void testFoundryInjectGroupedQueryNoErrors () {
         QuerySerializer s = new QuerySerializer();
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
index 09be840..2f069f1 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
@@ -16,7 +16,7 @@
 public class IdRewriteTest extends BeanConfigTest {
 
     @Test
-    public void insertTokenId() {
+    public void insertTokenId () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         assertTrue(handler.add(IdWriter.class));
@@ -32,8 +32,9 @@
         assertTrue(result.path("query").has("idn"));
     }
 
+
     @Test
-    public void testIdWriterTest() {
+    public void testIdWriterTest () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         assertTrue(handler.add(IdWriter.class));
@@ -47,8 +48,9 @@
         assertFalse(node.at("/query/idn").isMissingNode());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
index a3b19a0..91ee4e0 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
@@ -21,49 +21,54 @@
 public class PostRewriteTest extends BeanConfigTest {
 
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
 
     }
 
+
     // otherwise cache will maintain values not relevant for other tests
     @Before
-    public void before() {
+    public void before () {
         CacheManager.getInstance().getCache("documents").removeAll();
-        DocumentDao dao = new DocumentDao(
-                helper().getContext().getPersistenceClient());
+        DocumentDao dao = new DocumentDao(helper().getContext()
+                .getPersistenceClient());
         dao.truncate();
     }
 
+
     @Test
-    public void testPostRewriteNothingToDo() throws KustvaktException {
+    public void testPostRewriteNothingToDo () throws KustvaktException {
         RewriteHandler ha = new RewriteHandler();
         ha.insertBeans(helper().getContext());
         assertEquals("Handler could not be added to rewriter instance!", true,
                 ha.add(DocMatchRewrite.class));
 
-        DocumentDao dao = new DocumentDao(
-                helper().getContext().getPersistenceClient());
+        DocumentDao dao = new DocumentDao(helper().getContext()
+                .getPersistenceClient());
         try {
             Document d = dao.findbyId("BRZ13_APR.00014", null);
             assertNull(d);
             String v = ha.postProcess(RESULT, null);
             assertEquals("results do not match", JsonUtils.readTree(RESULT),
                     JsonUtils.readTree(v));
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             e.printStackTrace();
         }
     }
 
+
     @Test
-    public void testPostRewriteRemoveDoc() {
-        DocumentDao dao = new DocumentDao(
-                helper().getContext().getPersistenceClient());
+    public void testPostRewriteRemoveDoc () {
+        DocumentDao dao = new DocumentDao(helper().getContext()
+                .getPersistenceClient());
 
         Document doc = new Document("BRZ13_APR.00014");
         doc.setDisabled(true);
         try {
             dao.storeResource(doc, null);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             return;
         }
 
@@ -84,15 +89,17 @@
             Document d = dao.findbyId(doc.getPersistentID(), null);
             if (d != null)
                 System.out.println("IS SUPPOSED TO BE NULL! " + d);
-        }catch (KustvaktException e) {
+        }
+        catch (KustvaktException e) {
             e.printStackTrace();
             return;
         }
 
     }
 
+
     @Test
-    public void testPath() {
+    public void testPath () {
         String v = "{\n" + "    \"meta\": {\n" + "        \"count\": 25,\n"
                 + "        \"startIndex\": 0,\n"
                 + "        \"timeout\": 120000,\n" + "        \"context\": {\n"
@@ -104,368 +111,409 @@
 
     }
 
-    private static final String RESULT =
-            "{\n" + "    \"meta\": {\n" + "        \"count\": 25,\n"
-                    + "        \"startIndex\": 0,\n"
-                    + "        \"timeout\": 120000,\n"
-                    + "        \"context\": {\n" + "            \"left\": [\n"
-                    + "                \"token\",\n" + "                6\n"
-                    + "            ],\n" + "            \"right\": [\n"
-                    + "                \"token\",\n" + "                6\n"
-                    + "            ]\n" + "        },\n"
-                    + "        \"fields\": [\n" + "            \"textSigle\",\n"
-                    + "            \"author\",\n"
-                    + "            \"docSigle\",\n" + "            \"title\",\n"
-                    + "            \"pubDate\",\n" + "            \"UID\",\n"
-                    + "            \"corpusID\",\n"
-                    + "            \"textClass\",\n"
-                    + "            \"subTitle\",\n"
-                    + "            \"layerInfos\",\n" + "            \"ID\",\n"
-                    + "            \"pubPlace\",\n"
-                    + "            \"corpusSigle\"\n" + "        ],\n"
-                    + "        \"version\": \"unknown\",\n"
-                    + "        \"benchmark\": \"0.204314141 s\",\n"
-                    + "        \"totalResults\": 1755,\n"
-                    + "        \"serialQuery\": \"tokens:tt/l:Wort\",\n"
-                    + "        \"itemsPerPage\": 25\n" + "    },\n"
-                    + "    \"query\": {\n"
-                    + "        \"@type\": \"koral:token\",\n"
-                    + "        \"wrap\": {\n"
-                    + "            \"@type\": \"koral:term\",\n"
-                    + "            \"key\": \"Wort\",\n"
-                    + "            \"layer\": \"lemma\",\n"
-                    + "            \"match\": \"match:eq\",\n"
-                    + "            \"foundry\": \"tt\",\n"
-                    + "            \"rewrites\": [\n" + "                {\n"
-                    + "                    \"@type\": \"koral:rewrite\",\n"
-                    + "                    \"src\": \"Kustvakt\",\n"
-                    + "                    \"operation\": \"operation:injection\"\n"
-                    + "                }\n" + "            ]\n" + "        }\n"
-                    + "    },\n" + "    \"matches\": [\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"staat-gesellschaft familie-geschlecht\",\n"
-                    + "            \"title\": \"Sexueller Missbrauch –„Das schreiende Kind steckt noch tief in mir“\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in ihrer Stimme schwingt bei diesem </span><mark>Wort</mark><span class=\\\"context-right\\\"> Sarkasmus mit. Bis man einen passenden<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00001-p454-455\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00001\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"freizeit-unterhaltung reisen\",\n"
-                    + "            \"title\": \"Leben dick und prall\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der DLRG, ausgelassene Partys und markige </span><mark>Worte</mark><span class=\\\"context-right\\\"> des Dompredigers: „Ostern ist kein goethischer<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00014-p96-97\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00014\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"staat-gesellschaft biographien-interviews kultur musik\",\n"
-                    + "            \"title\": \"So wird es gemacht:\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>derfehlende Buchstabe.Gelingt es dir,das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vervollständigen? Tipp: Probiere auch mal rückwärts<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00055-p19-20\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00055\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik ausland\",\n"
-                    + "            \"title\": \"Südkorea droht mit Angriffen – USA rüsten auf\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der Stunde. „Aus einem Krieg der </span><mark>Worte</mark><span class=\\\"context-right\\\"> darf kein echter Krieg werden“, sagte<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00076-p238-239\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00076\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland freizeit-unterhaltung reisen\",\n"
-                    + "            \"title\": \"Dauercamper kämpfen für ihren Platz\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>„Initiative Campingplatz Räbke“. „Als ich das </span><mark>Wort</mark><span class=\\\"context-right\\\"> Schließung gelesen habe, war ich richtig<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00200-p255-256\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00200\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"freizeit-unterhaltung reisen\",\n"
-                    + "            \"title\": \"Neue Aktionen lockten Besucher\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Jan Waldheim (CWG) unter den aufmunternden </span><mark>Worten</mark><span class=\\\"context-right\\\"> eines augenzwinkernden Axel Schnalke („Ein bisschen<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00210-p142-143\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00210\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"kultur musik\",\n"
-                    + "            \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>trotzdem nicht. Selten wurden so viele </span><mark>Worte</mark><span class=\\\"context-right\\\">, die der Autor hier lieber verschweigt<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p166-167\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00253\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"kultur musik\",\n"
-                    + "            \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>zudem nicht immer nur bei den </span><mark>Worten</mark><span class=\\\"context-right\\\"> geblieben) und dabei gleichzeitig soviel Charme<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p191-192\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00253\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"kultur musik\",\n"
-                    + "            \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bedeutet Travestie sich zu verkleiden, das </span><mark>Wort</mark><span class=\\\"context-right\\\"> stammt aus dem Französischen. Traditionell belegten<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p371-372\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00253\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"sport fussball\",\n"
-                    + "            \"title\": \"VfL kommt nicht vom Fleck\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>am internationalen Geschäft berechtigt. Mit anderen </span><mark>Worten</mark><span class=\\\"context-right\\\">: Die „Wölfe“ stecken im grauen Mittelmaß<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00260-p93-94\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00260\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"sport fussball\",\n"
-                    + "            \"title\": \"Mensch, Mayer! Super Tor\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bekommst, ist das unbezahlbar – ein Bonus.“ </span><mark>Worte</mark><span class=\\\"context-right\\\">, die dem Torschützen weiteres Selbstvertrauen geben<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00275-p271-272\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00275\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"sport fussball\",\n"
-                    + "            \"title\": \"Nur Gerücht? KHL-Klub will „Dshuni“\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und hakt das Thema ab.cb Kein </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Interesse aus Astana: Daniar Dshunussow.Foto<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00277-p163-164\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00277\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-02\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"staat-gesellschaft biographien-interviews\",\n"
-                    + "            \"title\": \"Das Leben ist nicht auf diese Erde beschränkt\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>1. Korinther 1,18 denken: Denn das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vom Kreuz ist eine Torheit denen<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00520-p32-33\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00520\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-03\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"sport fussball\",\n"
-                    + "            \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Profis am Dienstag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> vom Führungsduo. Von Thorsten Grunow Wolfsburg<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p17-18\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00557\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-03\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"sport fussball\",\n"
-                    + "            \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Minuten setzte es am Dienstagnachmittag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> für die kickende Belegschaft, die durchaus<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p60-61\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00557\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-03\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"sport fussball\",\n"
-                    + "            \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Manager ist überzeugt, dass die klaren </span><mark>Worte</mark><span class=\\\"context-right\\\"> auf fruchtbaren Boden gefallen sind. „Ich<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p235-236\",\n"
-                    + "            \"docID\": \"BRZ13_APR.00557\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-04-03\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland politik ausland\",\n"
-                    + "            \"title\": \"Zeitungsartikelzufällig deponiert?\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>erspart“, lautete die Schlagzeile – wobei das </span><mark>Wort</mark><span class=\\\"context-right\\\"> „erspart“ abgeschnitten war. Ein plumper Versuch<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07616-p31-32\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07616\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland\",\n"
-                    + "            \"title\": \"„Philipp Rösler wackelt nicht“\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Vizekanzler bei all dem Jubel zu </span><mark>Wort</mark><span class=\\\"context-right\\\"> kommt. „Ein großartiger Tag“, sagt er<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07617-p177-178\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07617\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"freizeit-unterhaltung reisen\",\n"
-                    + "            \"title\": \"Lanz gibt den charmanten, zurückhaltenden Gastgeber\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>er, als seine Assistentin ihm ins </span><mark>Wort</mark><span class=\\\"context-right\\\"> fiel. Dennoch holte das ungleiche Duo<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07621-p261-262\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07621\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland\",\n"
-                    + "            \"title\": \"Mundlos denkt über Rücktritt nach\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>räumte selbst ein, wie sarkastisch diese </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach einer solchen Wahlnacht klingen mussten<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07694-p192-193\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07694\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland\",\n"
-                    + "            \"title\": \"BraunschweigGold – Hannover Blech\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Volksfreundhaus hört man kein schlechtes </span><mark>Wort</mark><span class=\\\"context-right\\\"> über den Kanzlerkandidaten Peer Steinbrück – und<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p169-170\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07695\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland\",\n"
-                    + "            \"title\": \"BraunschweigGold – Hannover Blech\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Volksfreundhaus merklich steigen. Hier hat das </span><mark>Wort</mark><span class=\\\"context-right\\\"> von der Wahlparty bei Bier, Bockwurst<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p266-267\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07695\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"staat-gesellschaft kirche\",\n"
-                    + "            \"title\": \"Fernsehen überträgt Gottesdienst\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>schon mal von der Sendung „Das </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Sonntag“ gehört. Das sind Predigten<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07840-p37-38\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07840\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland\",\n"
-                    + "            \"title\": \"Wahlkrimi im Ratssaal\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ihre Konkurrentin Glosemeyer hatte sie warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> übrig. „Für den ersten Anlauf eine<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07848-p147-148\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07848\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        },\n" + "        {\n"
-                    + "            \"field\": \"tokens\",\n"
-                    + "            \"textClass\": \"politik inland\",\n"
-                    + "            \"title\": \"Warme Worte nach eiskaltem Wahlkampf\",\n"
-                    + "            \"author\": \"\",\n"
-                    + "            \"startMore\": true,\n"
-                    + "            \"endMore\": true,\n"
-                    + "            \"corpusID\": \"BRZ13\",\n"
-                    + "            \"snippet\": \"<span class=\\\"context-left\\\">Warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach eiskaltem Wahlkampf Die SPD feierte<span class=\\\"more\\\"></span></span>\",\n"
-                    + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07850-p1-2\",\n"
-                    + "            \"docID\": \"BRZ13_JAN.07850\",\n"
-                    + "            \"UID\": 0,\n"
-                    + "            \"pubDate\": \"2013-01-21\"\n"
-                    + "        }\n" + "    ]\n" + "}";
+    private static final String RESULT = "{\n"
+            + "    \"meta\": {\n"
+            + "        \"count\": 25,\n"
+            + "        \"startIndex\": 0,\n"
+            + "        \"timeout\": 120000,\n"
+            + "        \"context\": {\n"
+            + "            \"left\": [\n"
+            + "                \"token\",\n"
+            + "                6\n"
+            + "            ],\n"
+            + "            \"right\": [\n"
+            + "                \"token\",\n"
+            + "                6\n"
+            + "            ]\n"
+            + "        },\n"
+            + "        \"fields\": [\n"
+            + "            \"textSigle\",\n"
+            + "            \"author\",\n"
+            + "            \"docSigle\",\n"
+            + "            \"title\",\n"
+            + "            \"pubDate\",\n"
+            + "            \"UID\",\n"
+            + "            \"corpusID\",\n"
+            + "            \"textClass\",\n"
+            + "            \"subTitle\",\n"
+            + "            \"layerInfos\",\n"
+            + "            \"ID\",\n"
+            + "            \"pubPlace\",\n"
+            + "            \"corpusSigle\"\n"
+            + "        ],\n"
+            + "        \"version\": \"unknown\",\n"
+            + "        \"benchmark\": \"0.204314141 s\",\n"
+            + "        \"totalResults\": 1755,\n"
+            + "        \"serialQuery\": \"tokens:tt/l:Wort\",\n"
+            + "        \"itemsPerPage\": 25\n"
+            + "    },\n"
+            + "    \"query\": {\n"
+            + "        \"@type\": \"koral:token\",\n"
+            + "        \"wrap\": {\n"
+            + "            \"@type\": \"koral:term\",\n"
+            + "            \"key\": \"Wort\",\n"
+            + "            \"layer\": \"lemma\",\n"
+            + "            \"match\": \"match:eq\",\n"
+            + "            \"foundry\": \"tt\",\n"
+            + "            \"rewrites\": [\n"
+            + "                {\n"
+            + "                    \"@type\": \"koral:rewrite\",\n"
+            + "                    \"src\": \"Kustvakt\",\n"
+            + "                    \"operation\": \"operation:injection\"\n"
+            + "                }\n"
+            + "            ]\n"
+            + "        }\n"
+            + "    },\n"
+            + "    \"matches\": [\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"staat-gesellschaft familie-geschlecht\",\n"
+            + "            \"title\": \"Sexueller Missbrauch –„Das schreiende Kind steckt noch tief in mir“\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in ihrer Stimme schwingt bei diesem </span><mark>Wort</mark><span class=\\\"context-right\\\"> Sarkasmus mit. Bis man einen passenden<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00001-p454-455\",\n"
+            + "            \"docID\": \"BRZ13_APR.00001\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+            + "            \"title\": \"Leben dick und prall\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der DLRG, ausgelassene Partys und markige </span><mark>Worte</mark><span class=\\\"context-right\\\"> des Dompredigers: „Ostern ist kein goethischer<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00014-p96-97\",\n"
+            + "            \"docID\": \"BRZ13_APR.00014\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"staat-gesellschaft biographien-interviews kultur musik\",\n"
+            + "            \"title\": \"So wird es gemacht:\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>derfehlende Buchstabe.Gelingt es dir,das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vervollständigen? Tipp: Probiere auch mal rückwärts<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00055-p19-20\",\n"
+            + "            \"docID\": \"BRZ13_APR.00055\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik ausland\",\n"
+            + "            \"title\": \"Südkorea droht mit Angriffen – USA rüsten auf\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der Stunde. „Aus einem Krieg der </span><mark>Worte</mark><span class=\\\"context-right\\\"> darf kein echter Krieg werden“, sagte<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00076-p238-239\",\n"
+            + "            \"docID\": \"BRZ13_APR.00076\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland freizeit-unterhaltung reisen\",\n"
+            + "            \"title\": \"Dauercamper kämpfen für ihren Platz\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>„Initiative Campingplatz Räbke“. „Als ich das </span><mark>Wort</mark><span class=\\\"context-right\\\"> Schließung gelesen habe, war ich richtig<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00200-p255-256\",\n"
+            + "            \"docID\": \"BRZ13_APR.00200\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+            + "            \"title\": \"Neue Aktionen lockten Besucher\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Jan Waldheim (CWG) unter den aufmunternden </span><mark>Worten</mark><span class=\\\"context-right\\\"> eines augenzwinkernden Axel Schnalke („Ein bisschen<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00210-p142-143\",\n"
+            + "            \"docID\": \"BRZ13_APR.00210\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"kultur musik\",\n"
+            + "            \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>trotzdem nicht. Selten wurden so viele </span><mark>Worte</mark><span class=\\\"context-right\\\">, die der Autor hier lieber verschweigt<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p166-167\",\n"
+            + "            \"docID\": \"BRZ13_APR.00253\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"kultur musik\",\n"
+            + "            \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>zudem nicht immer nur bei den </span><mark>Worten</mark><span class=\\\"context-right\\\"> geblieben) und dabei gleichzeitig soviel Charme<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p191-192\",\n"
+            + "            \"docID\": \"BRZ13_APR.00253\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"kultur musik\",\n"
+            + "            \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bedeutet Travestie sich zu verkleiden, das </span><mark>Wort</mark><span class=\\\"context-right\\\"> stammt aus dem Französischen. Traditionell belegten<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p371-372\",\n"
+            + "            \"docID\": \"BRZ13_APR.00253\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"sport fussball\",\n"
+            + "            \"title\": \"VfL kommt nicht vom Fleck\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>am internationalen Geschäft berechtigt. Mit anderen </span><mark>Worten</mark><span class=\\\"context-right\\\">: Die „Wölfe“ stecken im grauen Mittelmaß<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00260-p93-94\",\n"
+            + "            \"docID\": \"BRZ13_APR.00260\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"sport fussball\",\n"
+            + "            \"title\": \"Mensch, Mayer! Super Tor\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bekommst, ist das unbezahlbar – ein Bonus.“ </span><mark>Worte</mark><span class=\\\"context-right\\\">, die dem Torschützen weiteres Selbstvertrauen geben<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00275-p271-272\",\n"
+            + "            \"docID\": \"BRZ13_APR.00275\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"sport fussball\",\n"
+            + "            \"title\": \"Nur Gerücht? KHL-Klub will „Dshuni“\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und hakt das Thema ab.cb Kein </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Interesse aus Astana: Daniar Dshunussow.Foto<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00277-p163-164\",\n"
+            + "            \"docID\": \"BRZ13_APR.00277\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-02\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"staat-gesellschaft biographien-interviews\",\n"
+            + "            \"title\": \"Das Leben ist nicht auf diese Erde beschränkt\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>1. Korinther 1,18 denken: Denn das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vom Kreuz ist eine Torheit denen<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00520-p32-33\",\n"
+            + "            \"docID\": \"BRZ13_APR.00520\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-03\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"sport fussball\",\n"
+            + "            \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Profis am Dienstag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> vom Führungsduo. Von Thorsten Grunow Wolfsburg<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p17-18\",\n"
+            + "            \"docID\": \"BRZ13_APR.00557\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-03\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"sport fussball\",\n"
+            + "            \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Minuten setzte es am Dienstagnachmittag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> für die kickende Belegschaft, die durchaus<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p60-61\",\n"
+            + "            \"docID\": \"BRZ13_APR.00557\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-03\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"sport fussball\",\n"
+            + "            \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Manager ist überzeugt, dass die klaren </span><mark>Worte</mark><span class=\\\"context-right\\\"> auf fruchtbaren Boden gefallen sind. „Ich<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p235-236\",\n"
+            + "            \"docID\": \"BRZ13_APR.00557\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-04-03\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland politik ausland\",\n"
+            + "            \"title\": \"Zeitungsartikelzufällig deponiert?\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>erspart“, lautete die Schlagzeile – wobei das </span><mark>Wort</mark><span class=\\\"context-right\\\"> „erspart“ abgeschnitten war. Ein plumper Versuch<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07616-p31-32\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07616\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland\",\n"
+            + "            \"title\": \"„Philipp Rösler wackelt nicht“\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Vizekanzler bei all dem Jubel zu </span><mark>Wort</mark><span class=\\\"context-right\\\"> kommt. „Ein großartiger Tag“, sagt er<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07617-p177-178\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07617\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+            + "            \"title\": \"Lanz gibt den charmanten, zurückhaltenden Gastgeber\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>er, als seine Assistentin ihm ins </span><mark>Wort</mark><span class=\\\"context-right\\\"> fiel. Dennoch holte das ungleiche Duo<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07621-p261-262\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07621\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland\",\n"
+            + "            \"title\": \"Mundlos denkt über Rücktritt nach\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>räumte selbst ein, wie sarkastisch diese </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach einer solchen Wahlnacht klingen mussten<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07694-p192-193\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07694\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland\",\n"
+            + "            \"title\": \"BraunschweigGold – Hannover Blech\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Volksfreundhaus hört man kein schlechtes </span><mark>Wort</mark><span class=\\\"context-right\\\"> über den Kanzlerkandidaten Peer Steinbrück – und<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p169-170\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07695\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland\",\n"
+            + "            \"title\": \"BraunschweigGold – Hannover Blech\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Volksfreundhaus merklich steigen. Hier hat das </span><mark>Wort</mark><span class=\\\"context-right\\\"> von der Wahlparty bei Bier, Bockwurst<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p266-267\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07695\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"staat-gesellschaft kirche\",\n"
+            + "            \"title\": \"Fernsehen überträgt Gottesdienst\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>schon mal von der Sendung „Das </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Sonntag“ gehört. Das sind Predigten<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07840-p37-38\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07840\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland\",\n"
+            + "            \"title\": \"Wahlkrimi im Ratssaal\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ihre Konkurrentin Glosemeyer hatte sie warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> übrig. „Für den ersten Anlauf eine<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07848-p147-148\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07848\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n"
+            + "        },\n"
+            + "        {\n"
+            + "            \"field\": \"tokens\",\n"
+            + "            \"textClass\": \"politik inland\",\n"
+            + "            \"title\": \"Warme Worte nach eiskaltem Wahlkampf\",\n"
+            + "            \"author\": \"\",\n"
+            + "            \"startMore\": true,\n"
+            + "            \"endMore\": true,\n"
+            + "            \"corpusID\": \"BRZ13\",\n"
+            + "            \"snippet\": \"<span class=\\\"context-left\\\">Warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach eiskaltem Wahlkampf Die SPD feierte<span class=\\\"more\\\"></span></span>\",\n"
+            + "            \"matchID\": \"match-BRZ13!BRZ13_JAN.07850-p1-2\",\n"
+            + "            \"docID\": \"BRZ13_JAN.07850\",\n"
+            + "            \"UID\": 0,\n"
+            + "            \"pubDate\": \"2013-01-21\"\n" + "        }\n"
+            + "    ]\n" + "}";
 
 }
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
index d41a3a2..5eea4e2 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
@@ -20,19 +20,21 @@
 public class RewriteHandlerTest extends BeanConfigTest {
 
     @Test
-    public void initHandler() {
+    public void initHandler () {
         try {
             RewriteHandler handler = new RewriteHandler();
             handler.insertBeans(helper().getContext());
             assertTrue(handler.add(FoundryInject.class));
-        }catch (Exception e) {
+        }
+        catch (Exception e) {
             e.printStackTrace();
 
         }
     }
 
+
     @Test
-    public void testRewriteTaskAdd() {
+    public void testRewriteTaskAdd () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         assertTrue(handler.add(FoundryInject.class));
@@ -41,9 +43,10 @@
         assertTrue(handler.add(IdWriter.class));
     }
 
+
     // throws exception cause of missing configuration
     @Test(expected = RuntimeException.class)
-    public void testRewriteConfigThrowsException() {
+    public void testRewriteConfigThrowsException () {
         RewriteHandler handler = new RewriteHandler();
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
@@ -51,9 +54,11 @@
         handler.preProcess(s.toJSON(), null);
     }
 
+
     @Test
-    public void testRewriteNoBeanInject() {
-        RewriteHandler handler = new RewriteHandler(helper().getContext().getConfiguration());
+    public void testRewriteNoBeanInject () {
+        RewriteHandler handler = new RewriteHandler(helper().getContext()
+                .getConfiguration());
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
         assertTrue(handler.add(FoundryInject.class));
@@ -61,8 +66,9 @@
         assertNotNull(res);
     }
 
+
     @Test
-    public void testRewriteBeanInject() {
+    public void testRewriteBeanInject () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         QuerySerializer s = new QuerySerializer();
@@ -72,13 +78,16 @@
         JsonNode node = JsonUtils.readTree(res);
         assertNotNull(node);
 
-        assertEquals("tt", node.at("/query/wrap/operands/0/operands/0/foundry").asText());
-        assertEquals("tt", node.at("/query/wrap/operands/0/operands/1/foundry").asText());
+        assertEquals("tt", node.at("/query/wrap/operands/0/operands/0/foundry")
+                .asText());
+        assertEquals("tt", node.at("/query/wrap/operands/0/operands/1/foundry")
+                .asText());
         assertEquals("tt", node.at("/query/wrap/operands/1/foundry").asText());
     }
 
+
     @Test
-    public void testRewriteUserSpecific() {
+    public void testRewriteUserSpecific () {
         RewriteHandler handler = new RewriteHandler();
         handler.insertBeans(helper().getContext());
         QuerySerializer s = new QuerySerializer();
@@ -87,16 +96,21 @@
         String res = handler.preProcess(s.toJSON(), helper().getUser());
         JsonNode node = JsonUtils.readTree(res);
         assertNotNull(node);
-        assertEquals("tt_test", node.at("/query/wrap/operands/0/operands/0/foundry").asText());
-        assertEquals("tt_test", node.at("/query/wrap/operands/0/operands/1/foundry").asText());
-        assertNotEquals("tt_test", node.at("/query/wrap/operands/1/foundry").asText());
+        assertEquals("tt_test",
+                node.at("/query/wrap/operands/0/operands/0/foundry").asText());
+        assertEquals("tt_test",
+                node.at("/query/wrap/operands/0/operands/1/foundry").asText());
+        assertNotEquals("tt_test", node.at("/query/wrap/operands/1/foundry")
+                .asText());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
         UserDataDbIface settingsdao = BeansFactory.getTypeFactory()
-                .getTypedBean(helper().getContext().getUserDataDaos(),UserSettings.class);
+                .getTypedBean(helper().getContext().getUserDataDaos(),
+                        UserSettings.class);
         UserSettings s = (UserSettings) settingsdao.get(helper().getUser());
         s.setField(Attributes.DEFAULT_LEMMA_FOUNDRY, "tt_test");
         settingsdao.update(s);
diff --git a/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
index cc3afda..404b86a 100644
--- a/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
@@ -29,14 +29,15 @@
 
 
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
         helper().runBootInterfaces();
         helper().setupResource(new Corpus("WPD_1"));
     }
 
+
     @Test
-    public void testPoliciesGet() throws KustvaktException {
+    public void testPoliciesGet () throws KustvaktException {
         User user = helper().getUser();
         SecurityPolicy policy = new SecurityPolicy();
         policy.addNewCondition(new PolicyCondition("test_1"));
@@ -49,8 +50,9 @@
         dao.getPolicies("WPD_1", user, Permissions.Permission.READ.toByte());
     }
 
+
     @Test
-    public void testPolicyCreate() throws KustvaktException {
+    public void testPolicyCreate () throws KustvaktException {
         User user = helper().getUser();
         SecurityPolicy policy = new SecurityPolicy();
         policy.addNewCondition(new PolicyCondition("test_1"));
@@ -64,13 +66,15 @@
         assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
     }
 
+
     @Test
-    public void testMappingConditions() {
+    public void testMappingConditions () {
 
     }
 
+
     @Test
-    public void failAddToConditionEqual() throws KustvaktException {
+    public void failAddToConditionEqual () throws KustvaktException {
         User user = helper().getUser();
         SecurityPolicy policy = new SecurityPolicy();
         policy.addNewCondition(new PolicyCondition("test_1"));
@@ -88,8 +92,9 @@
 
     }
 
+
     @Test
-    public void failAddToConditionUnEqual() throws KustvaktException {
+    public void failAddToConditionUnEqual () throws KustvaktException {
         User user = helper().getUser();
         SecurityPolicy policy = new SecurityPolicy();
         policy.addNewCondition(new PolicyCondition("test_1"));
@@ -107,8 +112,9 @@
 
     }
 
+
     @Test
-    public void removeUserFromCondition() throws KustvaktException {
+    public void removeUserFromCondition () throws KustvaktException {
         User user = helper().getUser();
         PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
 
@@ -125,8 +131,9 @@
         assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
     }
 
+
     @Test
-    public void testPolicyHierarchySelfSameType() throws KustvaktException {
+    public void testPolicyHierarchySelfSameType () throws KustvaktException {
         String res = "WPD_child";
         User user = helper().getUser();
         Corpus c = new Corpus(res);
@@ -144,9 +151,10 @@
         helper().dropResource(res);
     }
 
+
     @Test
     @Ignore
-    public void testPolicyHierarchySelfDifferentType()
+    public void testPolicyHierarchySelfDifferentType ()
             throws KustvaktException {
         String res = "WPD_child";
         User user = helper().getUser();
@@ -165,43 +173,45 @@
         helper().dropResource(res);
     }
 
+
     @Test
-    public void testPolicyHierarchyPublic() {
+    public void testPolicyHierarchyPublic () {
 
     }
 
+
     @Test
-    public void testPoliciesPublic() {
+    public void testPoliciesPublic () {
         PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
-        Collection<SecurityPolicy> policies = dao
-                .getPolicies(new PolicyCondition("public"), Corpus.class,
-                        Permissions.Permission.READ.toByte());
+        Collection<SecurityPolicy> policies = dao.getPolicies(
+                new PolicyCondition("public"), Corpus.class,
+                Permissions.Permission.READ.toByte());
         assertNotEquals(0, policies.size());
     }
 
+
     @Test
     @Ignore
-    public void testPoliciesPublicGeneric() {
+    public void testPoliciesPublicGeneric () {
         PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
-        Collection<SecurityPolicy> policies = dao
-                .getPolicies(new PolicyCondition("public"),
-                        KustvaktResource.class,
-                        Permissions.Permission.READ.toByte());
+        Collection<SecurityPolicy> policies = dao.getPolicies(
+                new PolicyCondition("public"), KustvaktResource.class,
+                Permissions.Permission.READ.toByte());
         assertNotEquals(0, policies.size());
     }
 
+
     @Test
-    public void searchResourcePoliciesPublic() throws KustvaktException {
+    public void searchResourcePoliciesPublic () throws KustvaktException {
         User user = helper().getUser();
         new PolicyBuilder(user).setConditions(new PolicyCondition("public"))
                 .setPermissions(Permissions.Permission.READ)
                 .setResources(new VirtualCollection("new_corpus")).create();
 
         PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
-        List<SecurityPolicy> list = dao
-                .getPolicies(new PolicyCondition(Attributes.PUBLIC_GROUP),
-                        VirtualCollection.class,
-                        Permissions.Permission.READ.toByte());
+        List<SecurityPolicy> list = dao.getPolicies(new PolicyCondition(
+                Attributes.PUBLIC_GROUP), VirtualCollection.class,
+                Permissions.Permission.READ.toByte());
         assertNotEquals(0, list.size());
         Set<String> ids = new HashSet<>();
         for (SecurityPolicy p : list)
@@ -209,23 +219,27 @@
         assertNotEquals(0, ids.size());
     }
 
+
     @Test
-    public void testPolicyHierarchyRestricted() {
+    public void testPolicyHierarchyRestricted () {
 
     }
 
+
     @Test
-    public void testSelfPolicies() {
+    public void testSelfPolicies () {
 
     }
 
+
     @Test
-    public void testPublicPolicies() {
+    public void testPublicPolicies () {
 
     }
 
+
     @Test
-    public void testConditions() {
+    public void testConditions () {
 
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
index 681c197..973087b 100644
--- a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
@@ -22,18 +22,23 @@
 public class KustvaktAuthenticationManagerTest extends BeanConfigTest {
 
     @After
-    public void after() {
+    public void after () {
         try {
-            User user = helper().getContext().getAuthenticationManager().getUser(
-                    (String) KustvaktConfiguration.KUSTVAKT_USER
-                            .get(Attributes.USERNAME));
-            helper().getContext().getAuthenticationManager().deleteAccount(user);
-        } catch (KustvaktException e) {
+            User user = helper()
+                    .getContext()
+                    .getAuthenticationManager()
+                    .getUser(
+                            (String) KustvaktConfiguration.KUSTVAKT_USER
+                                    .get(Attributes.USERNAME));
+            helper().getContext().getAuthenticationManager()
+                    .deleteAccount(user);
         }
+        catch (KustvaktException e) {}
     }
 
+
     @Test
-    public void testCreateUser() throws KustvaktException {
+    public void testCreateUser () throws KustvaktException {
         User user = helper().getContext().getAuthenticationManager()
                 .createUserAccount(KustvaktConfiguration.KUSTVAKT_USER, false);
 
@@ -43,45 +48,50 @@
         assertNotNull(check);
     }
 
+
     @Test
-    public void testBatchStore() {
+    public void testBatchStore () {
         int i = 6;
 
         AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
-        for (int ix = 0; ix < i; ix++) {
-        }
+        for (int ix = 0; ix < i; ix++) {}
 
     }
 
+
     @Test
-    public void testUserdetailsGet() throws KustvaktException {
+    public void testUserdetailsGet () throws KustvaktException {
         testCreateUser();
         AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
 
-        User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
-                .get(Attributes.USERNAME));
+        User user = manager
+                .getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+                        .get(Attributes.USERNAME));
 
         Userdata data = manager.getUserData(user, UserDetails.class);
         assertNotNull(data);
     }
 
+
     @Test
-    public void testUsersettingsGet() throws KustvaktException {
+    public void testUsersettingsGet () throws KustvaktException {
         testCreateUser();
         AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
 
-        User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
-                .get(Attributes.USERNAME));
+        User user = manager
+                .getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+                        .get(Attributes.USERNAME));
 
         Userdata data = manager.getUserData(user, UserSettings.class);
         assertNotNull(data);
     }
 
+
     @Test(expected = KustvaktException.class)
-    public void testUserDetailsGetNonExistent() throws KustvaktException {
+    public void testUserDetailsGetNonExistent () throws KustvaktException {
         testCreateUser();
         AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
@@ -92,8 +102,9 @@
         assertNotNull(data);
     }
 
+
     @Test(expected = KustvaktException.class)
-    public void testUserSettingsGetNonExistent() throws KustvaktException {
+    public void testUserSettingsGetNonExistent () throws KustvaktException {
         testCreateUser();
         AuthenticationManagerIface manager = helper().getContext()
                 .getAuthenticationManager();
@@ -104,8 +115,9 @@
         assertNotNull(data);
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java b/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
index d569aa9..fdd328d 100644
--- a/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
+++ b/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
@@ -16,5 +16,4 @@
 @RunWith(Suite.class)
 @Suite.SuiteClasses({ PolicyDaoTest.class, UserdataTest.class,
         UserDaoTest.class, ResourceDaoTest.class })
-public class DaoTestSuite {
-}
+public class DaoTestSuite {}
diff --git a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
index de082af..65b93c8 100644
--- a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
+++ b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
@@ -19,34 +19,36 @@
 public class UserdataTest extends BeanConfigTest {
 
     @Before
-    public void clear() {
-        UserDetailsDao dao = new UserDetailsDao(
-                helper().getContext().getPersistenceClient());
-        UserSettingsDao sdao = new UserSettingsDao(
-                helper().getContext().getPersistenceClient());
+    public void clear () {
+        UserDetailsDao dao = new UserDetailsDao(helper().getContext()
+                .getPersistenceClient());
+        UserSettingsDao sdao = new UserSettingsDao(helper().getContext()
+                .getPersistenceClient());
         assertNotEquals(-1, dao.deleteAll());
         assertNotEquals(-1, sdao.deleteAll());
     }
 
+
     @Test
-    public void testDataStore() {
+    public void testDataStore () {
         String val = "value1;value_data";
         User user = new KorAPUser();
         user.setId(1);
-        UserDetailsDao dao = new UserDetailsDao(
-                helper().getContext().getPersistenceClient());
+        UserDetailsDao dao = new UserDetailsDao(helper().getContext()
+                .getPersistenceClient());
         UserDetails d = new UserDetails(1);
         d.setField("key_1", val);
         assertNotEquals(-1, dao.store(d));
     }
 
+
     @Test
-    public void testDataGet() throws dbException {
+    public void testDataGet () throws dbException {
         String val = "value1;value_data";
         User user = new KorAPUser();
         user.setId(1);
-        UserDetailsDao dao = new UserDetailsDao(
-                helper().getContext().getPersistenceClient());
+        UserDetailsDao dao = new UserDetailsDao(helper().getContext()
+                .getPersistenceClient());
         UserDetails d = new UserDetails(1);
         d.setField("key_1", val);
         assertNotEquals(-1, dao.store(d));
@@ -60,8 +62,9 @@
         assertEquals(val, d.get("key_1"));
     }
 
+
     @Test
-    public void testDataValidation() {
+    public void testDataValidation () {
         Userdata data = new UserDetails(1);
         data.setField(Attributes.COUNTRY, "Germany");
 
@@ -72,8 +75,9 @@
         assertFalse(data.isValid());
     }
 
+
     @Test
-    public void testSettingsValidation() {
+    public void testSettingsValidation () {
         Userdata data = new UserSettings(1);
         data.setField(Attributes.FILE_FORMAT_FOR_EXPORT, "export");
 
@@ -84,37 +88,40 @@
         assertTrue(data.isValid());
     }
 
+
     @Test
-    public void testUserdatafactory() throws KustvaktException {
-        UserDataDbIface dao = BeansFactory.getTypeFactory()
-                .getTypedBean(helper().getContext().getUserDataDaos(), UserDetails.class);
+    public void testUserdatafactory () throws KustvaktException {
+        UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), UserDetails.class);
         assertNotNull(dao);
         assertEquals(UserDetailsDao.class, dao.getClass());
 
-        dao = BeansFactory.getTypeFactory()
-                .getTypedBean(helper().getContext().getUserDataDaos(), UserSettings.class);
+        dao = BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), UserSettings.class);
         assertNotNull(dao);
         assertEquals(UserSettingsDao.class, dao.getClass());
 
     }
 
+
     @Test(expected = RuntimeException.class)
-    public void testUserdatafactoryError() throws KustvaktException {
-        BeansFactory.getTypeFactory()
-                .getTypedBean(helper().getContext().getUserDataDaos(), new Userdata(1) {
+    public void testUserdatafactoryError () throws KustvaktException {
+        BeansFactory.getTypeFactory().getTypedBean(
+                helper().getContext().getUserDataDaos(), new Userdata(1) {
                     @Override
-                    public String[] requiredFields() {
+                    public String[] requiredFields () {
                         return new String[0];
                     }
 
+
                     @Override
-                    public String[] defaultFields() {
+                    public String[] defaultFields () {
                         return new String[0];
                     }
                 }.getClass());
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
-    }
+    public void initMethod () throws KustvaktException {}
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index 83e1438..db7a860 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -37,49 +37,57 @@
     private static Client client;
     private static String[] classPackages = null;
 
-    public static void addClass(Class<?> resourceClass) {
+
+    public static void addClass (Class<?> resourceClass) {
         resourceConfig.getClasses().add(resourceClass);
     }
 
-    public static void setPackages(String... pack) {
+
+    public static void setPackages (String ... pack) {
         classPackages = pack;
     }
 
-    public static void addSingleton(Object resourceSingleton) {
+
+    public static void addSingleton (Object resourceSingleton) {
         resourceConfig.getSingletons().add(resourceSingleton);
     }
 
-    public String getAPIVersion() {
+
+    public String getAPIVersion () {
         return API_VERSION;
     }
 
-    public static <T> void addProviderForContext(Class<T> contextClass,
+
+    public static <T> void addProviderForContext (Class<T> contextClass,
             T contextObject) {
-        addSingleton(
-                new SingletonTypeInjectableProvider<Context, T>(contextClass,
-                        contextObject) {
-                });
+        addSingleton(new SingletonTypeInjectableProvider<Context, T>(
+                contextClass, contextObject) {});
     }
 
-    public static void addRequestFilter(Object filter) {
+
+    public static void addRequestFilter (Object filter) {
         resourceConfig.getContainerRequestFilters().add(filter);
     }
 
-    public static void addResponseFilter(Object filter) {
+
+    public static void addResponseFilter (Object filter) {
         resourceConfig.getContainerResponseFilters().add(filter);
     }
 
-    public static void setTestContainerFactory(
+
+    public static void setTestContainerFactory (
             TestContainerFactory newTestContainerFactory) {
         testContainerFactory = newTestContainerFactory;
     }
 
+
     @BeforeClass
-    public static void cleanStaticVariables() {
+    public static void cleanStaticVariables () {
         resourceConfig = new DefaultResourceConfig();
     }
 
-    public static void initServer() {
+
+    public static void initServer () {
         AppDescriptor ad;
         if (classPackages == null)
             ad = new LowLevelAppDescriptor.Builder(resourceConfig).build();
@@ -94,42 +102,47 @@
                 tcf = new GrizzlyWebTestContainerFactory();
         }
 
-        testContainer = tcf
-                .create(UriBuilder.fromUri("http://localhost/").port(9998)
-                        .build(), ad);
+        testContainer = tcf.create(UriBuilder.fromUri("http://localhost/")
+                .port(9998).build(), ad);
         client = testContainer.getClient();
         if (client == null) {
             client = Client.create(ad.getClientConfig());
         }
     }
 
-    public static void startServer() {
+
+    public static void startServer () {
         if (testContainer != null) {
             testContainer.start();
         }
     }
 
+
     @AfterClass
-    public static void stopServer() {
+    public static void stopServer () {
         testContainer.stop();
         testContainer = null;
         client = null;
     }
 
-    public Client client() {
+
+    public Client client () {
         return client;
     }
 
-    public URI getBaseUri() {
+
+    public URI getBaseUri () {
         return testContainer.getBaseUri();
     }
 
-    public WebResource resource() {
+
+    public WebResource resource () {
         return client.resource(getBaseUri());
     }
 
+
     @Before
-    public void startServerBeforeFirstTestRun() {
+    public void startServerBeforeFirstTestRun () {
         if (testContainer == null) {
             initServer();
             startServer();
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
index ce7851d..0a55637 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
@@ -24,13 +24,14 @@
 
     private static final String SCOPES = "search preferences queries account";
 
+
     @BeforeClass
-    public static void setup() throws Exception {
+    public static void setup () throws Exception {
         //        BeanConfiguration.loadClasspathContext("default-config.xml");
         //        handler = new OAuth2Handler(
         //                BeanConfiguration.getKustvaktContext().getPersistenceClient());
         //        crypto = BeanConfiguration.getKustvaktContext().getEncryption();
-//        info = new ClientInfo(crypto.createID(), crypto.createToken());
+        //        info = new ClientInfo(crypto.createID(), crypto.createToken());
         //        info.setConfidential(true);
         //        //todo: support for subdomains?!
         //        info.setUrl("http://localhost:8080/api/v0.1");
@@ -44,6 +45,7 @@
         //        crypto = helper.getBean(ContextHolder.KUSTVAKT_ENCRYPTION);
     }
 
+
     //    @AfterClass
     //    public static void drop() throws KustvaktException {
     //        assert handler != null;
@@ -53,28 +55,29 @@
     //    }
 
     @Test
-    public void testStoreAuthorizationCodeThrowsNoException()
+    public void testStoreAuthorizationCodeThrowsNoException ()
             throws KustvaktException {
         String auth_code = helper().getContext().getEncryption().createToken();
-        AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
-                auth_code);
+        AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(), auth_code);
         codeInfo.setScopes(SCOPES);
 
-        OAuth2Handler handler = new OAuth2Handler(helper().getContext().getPersistenceClient());
+        OAuth2Handler handler = new OAuth2Handler(helper().getContext()
+                .getPersistenceClient());
         handler.authorize(codeInfo, helper().getUser());
         codeInfo = handler.getAuthorization(auth_code);
         Assert.assertNotNull("client is null!", codeInfo);
     }
 
+
     @Test
-    public void testAuthorizationCodeRemoveThrowsNoException()
+    public void testAuthorizationCodeRemoveThrowsNoException ()
             throws KustvaktException {
         String auth_code = helper().getContext().getEncryption().createToken();
-        AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
-                auth_code);
+        AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(), auth_code);
         codeInfo.setScopes(SCOPES);
 
-        OAuth2Handler handler = new OAuth2Handler(helper().getContext().getPersistenceClient());
+        OAuth2Handler handler = new OAuth2Handler(helper().getContext()
+                .getPersistenceClient());
         handler.authorize(codeInfo, helper().getUser());
         String t = helper().getContext().getEncryption().createToken();
         String refresh = helper().getContext().getEncryption().createToken();
@@ -87,43 +90,49 @@
         Assert.assertNull("clearing authorization failed", c2);
     }
 
+
     @Test
-    public void testTokenEndpointRedirect() {
+    public void testTokenEndpointRedirect () {
 
     }
 
+
     @Test
-    public void testStoreAccessCodeViaAuthCodeThrowsNoException() {
+    public void testStoreAccessCodeViaAuthCodeThrowsNoException () {
         String auth_code = helper().getContext().getEncryption().createToken();
-        AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
-                auth_code);
+        AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(), auth_code);
         codeInfo.setScopes(SCOPES);
 
     }
 
+
     @Test
-    public void testDeleteAccessCodesByUserDeleteCascade() {
+    public void testDeleteAccessCodesByUserDeleteCascade () {
 
     }
 
+
     @Test
-    public void testAccessTokenbyUserDeleteCascade() {
+    public void testAccessTokenbyUserDeleteCascade () {
 
     }
 
+
     @Test
-    public void testRefreshToken() {
+    public void testRefreshToken () {
 
     }
 
+
     // fixme: exception thrown?!
     @Test
-    public void testAccessTokenExpired() {
+    public void testAccessTokenExpired () {
 
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
 
         EncryptionIface crypto = helper().getContext().getEncryption();
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
index 9a3f782..b394d68 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
@@ -14,7 +14,7 @@
 public class AuthServiceTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void configure() throws Exception {
+    public static void configure () throws Exception {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
@@ -22,28 +22,32 @@
 
 
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
     }
 
+
     @Test
-    public void testBasicHttp() {
+    public void testBasicHttp () {
         User user = helper().getUser();
 
     }
 
+
     @Test
-    public void testBasicLogout(){
+    public void testBasicLogout () {
 
     }
 
+
     @Test
-    public void testSessionTokenLogin() {
+    public void testSessionTokenLogin () {
 
     }
 
+
     @Test
-    public void testSessionTokenLogout() {
+    public void testSessionTokenLogout () {
 
     }
 
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
index ac05e24..5392eec 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
@@ -17,40 +17,49 @@
 public class FilterTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void setup() throws Exception {
+    public static void setup () throws Exception {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
     }
 
+
     @Test
-    public void testTestUserAuth() {
-        ClientResponse resp = resource().path(getAPIVersion()).path("user/info")
-                .header(Attributes.AUTHORIZATION, BasicHttpAuth
-                        .encode(TestHelper.getUserCredentials()[0],
+    public void testTestUserAuth () {
+        ClientResponse resp = resource()
+                .path(getAPIVersion())
+                .path("user/info")
+                .header(Attributes.AUTHORIZATION,
+                        BasicHttpAuth.encode(
+                                TestHelper.getUserCredentials()[0],
                                 TestHelper.getUserCredentials()[1]))
                 .get(ClientResponse.class);
         assert resp.getStatus() == Response.SC_OK;
     }
 
+
     @Test
-    public void testDemoAuth() {
-        ClientResponse resp = resource().path(getAPIVersion()).path("user/info")
-                .get(ClientResponse.class);
+    public void testDemoAuth () {
+        ClientResponse resp = resource().path(getAPIVersion())
+                .path("user/info").get(ClientResponse.class);
         assert resp.getStatus() == Response.SC_OK;
     }
 
+
     @Test
-    public void testUnauthorizedAuth() {
-        ClientResponse resp = resource().path(getAPIVersion()).path("user/info")
+    public void testUnauthorizedAuth () {
+        ClientResponse resp = resource()
+                .path(getAPIVersion())
+                .path("user/info")
                 .header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
         assert resp.getStatus() == Response.SC_UNAUTHORIZED;
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
index f227ba3..ec25c17 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
@@ -20,22 +20,24 @@
 public class KustvaktCoreRestTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void configure() {
+    public static void configure () {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.light",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
     }
 
+
     //    @Test
-    public void testFieldsInSearch() {
+    public void testFieldsInSearch () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[base=Wort]")
                 .queryParam("ql", "poliqarp").get(ClientResponse.class);
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
+
     @Test
-    public void testQuery() {
+    public void testQuery () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[base=Wort]")
                 .queryParam("ql", "poliqarp").get(ClientResponse.class);
@@ -44,8 +46,9 @@
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
+
     @Test
-    public void testQueryRaw() {
+    public void testQueryRaw () {
         QuerySerializer s = new QuerySerializer();
         s.setQuery("[base=Wort]", "poliqarp");
 
@@ -56,29 +59,34 @@
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
+
     // in case no index is there, this will throw an error
     @Test
     @Ignore
-    public void testGetMatchInfoThrowsNoException() {
-        ClientResponse response = resource().path(getAPIVersion())
-                .get(ClientResponse.class);
+    public void testGetMatchInfoThrowsNoException () {
+        ClientResponse response = resource().path(getAPIVersion()).get(
+                ClientResponse.class);
     }
 
+
     //    @Test
-    public void testGetStatsThrowsNoException() {
+    public void testGetStatsThrowsNoException () {
         CollectionQueryProcessor pr = new CollectionQueryProcessor();
         pr.process("corpusID=WPD & textClass=Sport");
         Map map = new LinkedHashMap();
         map.put("collection", pr.getRequestMap());
-        ClientResponse response = resource().path(getAPIVersion()).path("stats")
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("stats")
                 .post(ClientResponse.class, JsonUtils.toJSON(map));
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
+
     @Test
     @Ignore
-    public void testGetStats2ThrowsNoException() {
-        ClientResponse response = resource().path(getAPIVersion()).path("stats")
+    public void testGetStats2ThrowsNoException () {
+        ClientResponse response = resource().path(getAPIVersion())
+                .path("stats")
                 .post(ClientResponse.class, "creationDate in 1787");
         String ent = response.getEntity(String.class);
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
@@ -87,8 +95,9 @@
         //        System.out.println("STATS ENTITY " + ent);
     }
 
+
     //    @Test
-    public void testBuildQueryThrowsNoException() {
+    public void testBuildQueryThrowsNoException () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[base=Haus & surface=Hauses]")
                 .queryParam("ql", "poliqarp").queryParam("cutOff", "true")
@@ -96,8 +105,9 @@
         assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
     }
 
+
     //    @Test
-    public void testQueryByNameThrowsNoException() {
+    public void testQueryByNameThrowsNoException () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus").path("WPD").path("search")
                 .queryParam("q", "[base=Haus & surface=Hauses]")
@@ -106,8 +116,9 @@
         System.out.println("RESPONSE " + response.getEntity(String.class));
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
index 9870cea..60b7267 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
@@ -20,25 +20,28 @@
 public class OAuth2EndpointTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void configure() throws Exception {
+    public static void configure () throws Exception {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
     }
 
+
     @Test
-    public void init() {
+    public void init () {
 
     }
 
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().setupAccount();
     }
 
+
     @Test
     @Ignore
-    public void testAuthorizeClient() {
+    public void testAuthorizeClient () {
         ClientResponse response = resource().path("v0.1").path("oauth2")
                 .path("register")
                 .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
@@ -47,9 +50,10 @@
         assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
     }
 
+
     @Test
     @Ignore
-    public void testRevokeClient() {
+    public void testRevokeClient () {
         ClientResponse response = resource().path("v0.1").path("oauth2")
                 .path("register")
                 .queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
@@ -60,9 +64,10 @@
 
     }
 
+
     @Test
     @Ignore
-    public void authenticate() {
+    public void authenticate () {
         String[] cred = TestHelper.getUserCredentials();
         String enc = BasicHttpAuth.encode(cred[0], cred[1]);
         ClientResponse response = resource().path("v0.1").path("oauth2")
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java
index bcf5f9a..95d7470 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java
@@ -11,7 +11,7 @@
 
 
     @Test
-    public void testResourceGetFromDemo() {
+    public void testResourceGetFromDemo () {
 
     }
 }
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index f3cf778..d9e761c 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -23,17 +23,19 @@
 public class ResourceServiceTest extends FastJerseyTest {
 
     @BeforeClass
-    public static void configure() throws Exception {
+    public static void configure () throws Exception {
         FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
                 "de.ids_mannheim.korap.web.filter",
                 "de.ids_mannheim.korap.web.utils");
     }
 
+
     @Test
-    @Ignore
-    public void testSearchSimple() {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("search").queryParam("q", "[orth=das]")
+    public void testSearchSimple () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("search")
+                .queryParam("q", "[orth=das]")
                 .queryParam("ql", "poliqarp")
                 //                .queryParam("cq", "corpusID=GOE")
                 .header(Attributes.AUTHORIZATION,
@@ -43,15 +45,17 @@
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        Assert.assertNotNull(node);
+        assertNotNull(node);
         assertNotEquals(0, node.path("matches").size());
     }
 
+
     @Test
-    @Ignore
-    public void testCollectionGet() {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").header(Attributes.AUTHORIZATION,
+    public void testCollectionGet () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("collection")
+                .header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -61,49 +65,58 @@
         assertNotEquals(0, node.size());
     }
 
+
     @Test
-    @Ignore
-    public void testStats() {
-        ClientResponse response = resource().path(getAPIVersion())
-                .path("collection").header(Attributes.AUTHORIZATION,
+    public void testStats () {
+        ClientResponse response = resource()
+                .path(getAPIVersion())
+                .path("collection")
+                .header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
 
         JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
-        Assert.assertNotNull(node);
+        assertNotNull(node);
+        assertNotEquals(0, node.size());
 
-        System.out.println("-------------------------------");
-        System.out.println("NODE COLLECTIONS" + node);
         String id = node.path(0).path("id").asText();
 
-        System.out.println("ID IS " + id);
-        System.out.println("FROM NODE " + node);
-        response = resource().path(getAPIVersion()).path("collection").path(id)
-                .path("stats").header(Attributes.AUTHORIZATION,
+        response = resource()
+                .path(getAPIVersion())
+                .path("collection")
+                .path(id)
+                .path("stats")
+                .header(Attributes.AUTHORIZATION,
                         BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
                 .get(ClientResponse.class);
 
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
         node = JsonUtils.readTree(response.getEntity(String.class));
-        Assert.assertNotNull(node);
+        assertNotNull(node);
         int docs = node.path("documents").asInt();
-        System.out.println("-------------------------------");
-        System.out.println("NODE " + node);
         assertNotEquals(0, docs);
         Assert.assertTrue(docs < 15);
     }
 
+
     @Test
-    public void testResourceStore() {
+    public void testResourceStore () {
 
     }
 
+
+    @Test
+    public void testResourceDelete () {
+
+    }
+
+
     @Test
     @Ignore
-    public void testSerializationQueryInCollection() {
+    public void testSerializationQueryInCollection () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("corpus/WPD/search").queryParam("q", "[base=Haus]")
                 .queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
@@ -113,8 +126,9 @@
         System.out.println("Entity 1 " + ent);
     }
 
+
     @Test
-    public void testSerializationQueryPublic() {
+    public void testSerializationQueryPublic () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[base=Haus]")
                 .queryParam("ql", "poliqarp").queryParam("context", "sentence")
@@ -125,8 +139,9 @@
         System.out.println(node);
     }
 
+
     @Test
-    public void testQuery() {
+    public void testQuery () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("q", "[base=Haus]")
                 .queryParam("ql", "poliqarp").queryParam("context", "sentence")
@@ -138,24 +153,33 @@
         assertNotEquals("${project.version}", "/meta/version");
     }
 
+
     @Test
     @Ignore
-    public void testSerializationMeta() {
+    public void testSerializationMeta () {
         ClientResponse response = resource().path(getAPIVersion())
                 .path("search").queryParam("context", "sentence")
                 .queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
                 .get(ClientResponse.class);
     }
 
+
     @Test
     @Ignore
-    public void testSerializationCollection() {
+    public void testSerializationCollection () {
         ClientResponse response = resource().path(getAPIVersion()).path("")
                 .get(ClientResponse.class);
     }
 
+
+    @Test
+    public void testMatchInfo () {
+
+    }
+
+
     @Override
-    public void initMethod() throws KustvaktException {
+    public void initMethod () throws KustvaktException {
         helper().runBootInterfaces();
     }
 }