Added comments & updated code structure.

Change-Id: I2ff7adb2954b87e8345a6e0619b14614883c4200
diff --git a/core/Changes b/core/Changes
index c5ba7df..4b47cb8 100644
--- a/core/Changes
+++ b/core/Changes
@@ -5,7 +5,13 @@
    - Updated RewriteHandler (margaretha)
 19/12/2018
    - Added debug flags (margaretha)
-   - Added order on the fields parameter of search get request (margaretha)   
+   - Added order on the fields parameter of search get request (margaretha)
+07/01/2019
+   - Disabled send shutdown to existing jetty web server at start (margaretha)
+09/01/2019
+   - Added comments (margaretha)
+   - Updated code structure (margaretha)
+   - Removed spring security libraries and ManagerInterface (margaretha)
 
 version 0.61.4
 14/11/2018
diff --git a/core/pom.xml b/core/pom.xml
index 869823c..dfd73fe 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -3,12 +3,12 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>de.ids_mannheim.korap</groupId>
 	<artifactId>Kustvakt-core</artifactId>
-	<version>0.61.4</version>
+	<version>0.61.5</version>
 
 	<properties>
 		<java.version>1.8</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<spring.version>5.1.1.RELEASE</spring.version>
+		<spring.version>5.1.2.RELEASE</spring.version>
 		<jersey.version>1.19.4</jersey.version>
 		<jetty.version>9.4.12.v20180830</jetty.version>
 		<hibernate.version>5.3.7.Final</hibernate.version>
@@ -153,6 +153,12 @@
 			<artifactId>json-smart</artifactId>
 			<version>1.0.9</version>
 		</dependency>
+		<!-- JSON support in Jersey -->
+		<dependency>
+			<groupId>com.fasterxml.jackson.jaxrs</groupId>
+			<artifactId>jackson-jaxrs-json-provider</artifactId>
+			<version>[2.9.5,)</version>
+		</dependency>
 
 		<!-- Flyway -->
 		<dependency>
@@ -335,7 +341,7 @@
 			<artifactId>spring-tx</artifactId>
 			<version>${spring.version}</version>
 		</dependency>
-		<dependency>
+		<!-- <dependency>
 			<groupId>org.springframework.security</groupId>
 			<artifactId>spring-security-core</artifactId>
 			<version>${spring.version}</version>
@@ -344,7 +350,7 @@
 			<groupId>org.springframework.security</groupId>
 			<artifactId>spring-security-web</artifactId>
 			<version>${spring.version}</version>
-		</dependency>
+		</dependency> -->
 		<!-- EM: done -->
 		<dependency>
 			<groupId>org.springframework</groupId>
diff --git a/core/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java b/core/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java
index 5b9cd87..8aca637 100644
--- a/core/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java
+++ b/core/src/main/java/de/ids_mannheim/korap/annotation/AnnotationParser.java
@@ -23,6 +23,11 @@
 import de.ids_mannheim.korap.entity.AnnotationKey;
 import de.ids_mannheim.korap.entity.AnnotationLayer;
 
+/** Parser for extracting annotation descriptions from Kalamar javascripts 
+ * 
+ * @author margaretha
+ *
+ */
 @Component
 public class AnnotationParser {
 
diff --git a/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index 7aab419..2d0d720 100644
--- a/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -11,7 +11,6 @@
 import java.util.Properties;
 import java.util.Set;
 import java.util.regex.Pattern;
-import java.util.stream.Collectors;
 
 import de.ids_mannheim.korap.util.KrillProperties;
 import de.ids_mannheim.korap.utils.TimeUtils;
@@ -19,14 +18,15 @@
 import lombok.Setter;
 
 /**
- * if configuration class is extended, loadSubTypes method should be
+ * Describes configuration for Kustvakt by importing properties 
+ * from kustvakt.conf file and setting default values if they are 
+ * not configured.  
+ * 
+ * MH: if configuration class is extended, loadSubTypes method should be
  * overriden
  * 
  * @author hanl
- * @date 05/02/2014
- * 
  * @author margaretha
- * - cleaned up log4j loader
  */
 
 @Setter
diff --git a/core/src/main/java/de/ids_mannheim/korap/constant/AnnotationType.java b/core/src/main/java/de/ids_mannheim/korap/constant/AnnotationType.java
index 560d401..ea91e16 100644
--- a/core/src/main/java/de/ids_mannheim/korap/constant/AnnotationType.java
+++ b/core/src/main/java/de/ids_mannheim/korap/constant/AnnotationType.java
@@ -1,5 +1,10 @@
 package de.ids_mannheim.korap.constant;
 
+/** Defines various annotation types as constants  
+ * 
+ * @author margaretha
+ *
+ */
 public class AnnotationType {
     public static String FOUNDRY = "foundry";
     public static String LAYER = "layer";
diff --git a/core/src/main/java/de/ids_mannheim/korap/constant/OAuth2Scope.java b/core/src/main/java/de/ids_mannheim/korap/constant/OAuth2Scope.java
index 9993541..dea8ca7 100644
--- a/core/src/main/java/de/ids_mannheim/korap/constant/OAuth2Scope.java
+++ b/core/src/main/java/de/ids_mannheim/korap/constant/OAuth2Scope.java
@@ -1,5 +1,10 @@
 package de.ids_mannheim.korap.constant;
 
+/** Defines all possible authorization scopes
+ * 
+ * @author margaretha
+ *
+ */
 public enum OAuth2Scope {
     
     ALL, 
diff --git a/core/src/main/java/de/ids_mannheim/korap/constant/TokenType.java b/core/src/main/java/de/ids_mannheim/korap/constant/TokenType.java
index 418be0b..76bac5b 100644
--- a/core/src/main/java/de/ids_mannheim/korap/constant/TokenType.java
+++ b/core/src/main/java/de/ids_mannheim/korap/constant/TokenType.java
@@ -2,6 +2,15 @@
 
 import org.apache.commons.lang.StringUtils;
 
+import de.ids_mannheim.korap.security.context.TokenContext;
+
+/** Defines the types of authentication tokens. Token types are used to
+ * create {@link TokenContext} and determine which authentication provider
+ * must be used to create a TokenContext and parse given tokens. 
+ * 
+ * @author margaretha
+ *
+ */
 public enum TokenType {
     BASIC, API, SESSION, 
     // openid token, e.g. within oauth2 response (json body)
diff --git a/core/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java b/core/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java
index ef54fda..0c527d7 100644
--- a/core/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java
+++ b/core/src/main/java/de/ids_mannheim/korap/dao/AnnotationDao.java
@@ -25,7 +25,7 @@
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
 /**
- * AnnotationDao manages SQL queries regarding annotations including
+ * AnnotationDao manages queries to database regarding annotations including
  * foundry and layer pairs.
  * 
  * @author margaretha
diff --git a/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationKey.java b/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationKey.java
index d65ffb2..a4ccdaa 100644
--- a/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationKey.java
+++ b/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationKey.java
@@ -18,6 +18,14 @@
 import lombok.Getter;
 import lombok.Setter;
 
+/**
+ * Describes the annotation key mapping to annotation_key table in the
+ * database and annotation key relations to {@link AnnotationLayer}
+ * and {@link Annotation}.
+ * 
+ * @author margaretha
+ *
+ */
 @Setter
 @Getter
 @Entity
diff --git a/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationLayer.java b/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationLayer.java
index c16abec..00f6d6e 100644
--- a/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationLayer.java
+++ b/core/src/main/java/de/ids_mannheim/korap/entity/AnnotationLayer.java
@@ -22,7 +22,7 @@
 import lombok.Setter;
 
 /**
- * Describes annotations as a pair, e.g. foundry and layer where
+ * Describes annotation layers as a pair of foundry and layer where
  * foundry denotes where the annotation comes from e.g. Tree tagger
  * parser, and layer denotes the annotation layer e.g. part of speech.
  * 
diff --git a/core/src/main/java/de/ids_mannheim/korap/entity/Resource.java b/core/src/main/java/de/ids_mannheim/korap/entity/Resource.java
index 813adc5..246d80d 100644
--- a/core/src/main/java/de/ids_mannheim/korap/entity/Resource.java
+++ b/core/src/main/java/de/ids_mannheim/korap/entity/Resource.java
@@ -16,8 +16,8 @@
 
 /**
  * Describes resources having free licenses. Primarily for
- * accommodating
- * clients in providing data without login such as KorapSRU.
+ * accommodating clients in providing data without login such as
+ * KorapSRU.
  * 
  * @author margaretha
  *
diff --git a/core/src/main/java/de/ids_mannheim/korap/managers/ManagerInterface.java b/core/src/main/java/de/ids_mannheim/korap/managers/ManagerInterface.java
deleted file mode 100644
index 946dfc2..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/managers/ManagerInterface.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package de.ids_mannheim.korap.managers;
-
-import java.util.Set;
-
-/**
- * @author hanl
- * @date 17/02/2016
- */
-public interface ManagerInterface {
-
-    String name ();
-
-
-    Set<Function> getFunctions ();
-
-
-    Result process ();
-
-    class Result {
-
-    }
-
-    class Function {
-
-        private String name;
-        private String[] args;
-
-
-        @Override
-        public boolean equals (Object o) {
-            if (this == o)
-                return true;
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            Function function = (Function) o;
-
-            return name != null ? name.equals(function.name)
-                    : function.name == null;
-
-        }
-
-
-        @Override
-        public int hashCode () {
-            return name != null ? name.hashCode() : 0;
-        }
-
-
-        public void setName (String name) {
-            this.name = name;
-        }
-
-
-        public void setArgs (String ... args) {
-            this.args = args;
-        }
-
-    }
-
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanRewrite.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/CollectionCleanRewrite.java
similarity index 97%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanRewrite.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/CollectionCleanRewrite.java
index 7a4ab70..6cacd4b 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/CollectionCleanRewrite.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/CollectionCleanRewrite.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/FoundryInject.java
similarity index 92%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/FoundryInject.java
index 1048f1b..f682414 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/FoundryInject.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/FoundryInject.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import java.util.Collection;
 
@@ -8,8 +8,7 @@
 import de.ids_mannheim.korap.config.ContextHolder;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.resource.LayerMapper;
-import de.ids_mannheim.korap.resource.rewrite.KoralNode.RewriteIdentifier;
+import de.ids_mannheim.korap.rewrite.KoralNode.RewriteIdentifier;
 import de.ids_mannheim.korap.user.User;
 import edu.emory.mathcs.backport.java.util.Collections;
 
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/IdWriter.java
similarity index 95%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/IdWriter.java
index 4dc91b9..1f0dad6 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/IdWriter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/IdWriter.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import de.ids_mannheim.korap.config.BeanInjectable;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java
similarity index 99%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java
index 0bf497f..a8870b7 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/KoralNode.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/KoralNode.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.node.ArrayNode;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/LayerMapper.java
similarity index 98%
rename from core/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/LayerMapper.java
index fa6459b..672f7e7 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/LayerMapper.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/LayerMapper.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource;
+package de.ids_mannheim.korap.rewrite;
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.config.Attributes;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/MetaConstraint.java
similarity index 94%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/MetaConstraint.java
index f0e90e3..a9380b9 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/MetaConstraint.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/MetaConstraint.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import de.ids_mannheim.korap.config.BeanInjectable;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/RewriteHandler.java
similarity index 99%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/RewriteHandler.java
index 6469d57..ddd7538 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandler.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/RewriteHandler.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/RewriteTask.java
similarity index 97%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/RewriteTask.java
index deb4cd7..79065a5 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/RewriteTask.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/RewriteTask.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
diff --git a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java b/core/src/main/java/de/ids_mannheim/korap/rewrite/TreeConstraint.java
similarity index 97%
rename from core/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java
rename to core/src/main/java/de/ids_mannheim/korap/rewrite/TreeConstraint.java
index 5235359..1315c7a 100644
--- a/core/src/main/java/de/ids_mannheim/korap/resource/rewrite/TreeConstraint.java
+++ b/core/src/main/java/de/ids_mannheim/korap/rewrite/TreeConstraint.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import de.ids_mannheim.korap.config.BeanInjectable;
diff --git a/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java b/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java
index 1552bf3..10414bf 100644
--- a/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java
+++ b/core/src/main/java/de/ids_mannheim/korap/service/SearchService.java
@@ -23,7 +23,7 @@
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.query.serialize.MetaQueryBuilder;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
+import de.ids_mannheim.korap.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.user.User.CorpusAccess;
 import de.ids_mannheim.korap.web.ClientsHandler;
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java b/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java
index 06b9957..63e19de 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/controller/AnnotationController.java
@@ -23,7 +23,7 @@
 import de.ids_mannheim.korap.service.AnnotationService;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.DemoUserFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
 
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java b/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java
index d83ce1f..0cd61a3 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/controller/SearchController.java
@@ -29,8 +29,8 @@
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.service.SearchService;
-import de.ids_mannheim.korap.web.APIVersionFilter;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.DemoUserFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java b/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java
index 61bf57a..ff21813 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/controller/StatisticController.java
@@ -23,7 +23,7 @@
 import de.ids_mannheim.korap.utils.KoralCollectionQueryBuilder;
 import de.ids_mannheim.korap.web.CoreResponseHandler;
 import de.ids_mannheim.korap.web.SearchKrill;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
 
 /**
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/APIVersionFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java
similarity index 97%
rename from core/src/main/java/de/ids_mannheim/korap/web/APIVersionFilter.java
rename to core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java
index 0a36153..db9536d 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/APIVersionFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/APIVersionFilter.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.web;
+package de.ids_mannheim.korap.web.filter;
 
 import java.util.List;
 
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java b/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java
index d0e4562..1f54669 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/filter/AuthenticationFilter.java
@@ -21,7 +21,11 @@
 import de.ids_mannheim.korap.utils.TimeUtils;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
 
-/**
+/** Authentication filter extracts an authentication token from 
+ * authorization header and uses an authentication provider 
+ * with respect to the token type to create a token context as
+ * a security context.
+ * 
  * @author hanl, margaretha
  * @date 28/01/2014
  * @last update 12/2017
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java
index 1136dd1..126f34d 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java
@@ -10,12 +10,20 @@
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.web.CoreResponseHandler;
 
-@Priority(value=1)
+/**
+ * Creates appropriate responses in case of incorrect JSON
+ * deserialization or JsonMappingException, for instance when a
+ * request parameter should be deserialized as an ENUM but the
+ * parameter value does not match any of the available ENUM values.
+ * 
+ * @author margaretha
+ *
+ */
+@Priority(value = 1)
 @Provider
 public class JsonExceptionMapper
         implements ExceptionMapper<JsonMappingException> {
 
-
     @Override
     public Response toResponse (JsonMappingException exception) {
         String entity = CoreResponseHandler.buildNotification(
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java
index e8db76d..d2536f6 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/NotFoundMapper.java
@@ -19,12 +19,18 @@
 
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 
+/**
+ * Handles not found API version by redirecting the request URI to a
+ * similar URI with current API version.
+ * 
+ * @author margaretha
+ *
+ */
 @Component
 @Provider
 public class NotFoundMapper implements ExceptionMapper<NotFoundException> {
 
-    private static Logger jlog =
-            LogManager.getLogger(NotFoundMapper.class);
+    private static Logger jlog = LogManager.getLogger(NotFoundMapper.class);
     public static final Pattern VERSION_PATTERN =
             Pattern.compile("/(v[0-9][^/]*)(/.*)");
     private static final boolean DEBUG = false;
@@ -47,19 +53,19 @@
                 path = baseUrl + "/" + config.getCurrentVersion() + path;
                 URI redirectUri = UriBuilder.fromUri(notFoundUri)
                         .replacePath(path).build();
-                if (DEBUG){
-                    jlog.debug("REDIRECT: "+redirectUri.toString());
+                if (DEBUG) {
+                    jlog.debug("REDIRECT: " + redirectUri.toString());
                 }
                 return Response.status(HttpStatus.PERMANENT_REDIRECT_308)
                         .location(redirectUri).build();
             }
-            else if (!matcher.group(1).equals(config.getCurrentVersion())){
+            else if (!matcher.group(1).equals(config.getCurrentVersion())) {
                 path = baseUrl + "/" + config.getCurrentVersion()
                         + matcher.group(2);
                 URI redirectUri = UriBuilder.fromUri(notFoundUri)
                         .replacePath(path).build();
-                if (DEBUG){
-                    jlog.debug("REDIRECT replace: "+ redirectUri.toString());
+                if (DEBUG) {
+                    jlog.debug("REDIRECT replace: " + redirectUri.toString());
                 }
                 return Response.status(HttpStatus.PERMANENT_REDIRECT_308)
                         .location(redirectUri).build();
diff --git a/full/Changes b/full/Changes
index 2cfe740..e30c3c4 100644
--- a/full/Changes
+++ b/full/Changes
@@ -5,6 +5,9 @@
    - Updated tests using BeanConfigTest to use SpringJerseyTest (margaretha)
 08/01/2019
    - Improved predefined vc caching (issue #28, margaretha)
+09/01/2019
+   - Added comments (margaretha)
+   - Updated code structure (margaretha)
 
 # version 0.61.4
 14/11/2018
diff --git a/full/pom.xml b/full/pom.xml
index 3278b7b..c01f914 100644
--- a/full/pom.xml
+++ b/full/pom.xml
@@ -7,8 +7,6 @@
 	<properties>
 		<java.version>1.8</java.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<spring.version>5.1.1.RELEASE</spring.version>
-		<jetty.version>9.4.12.v20180830</jetty.version>
 		<jersey.version>1.19.4</jersey.version>
 		<hibernate.version>5.3.7.Final</hibernate.version>
 	</properties>
diff --git a/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java b/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java
index a06f738..290351c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java
+++ b/full/src/main/java/de/ids_mannheim/korap/annotation/FreeResourceParser.java
@@ -19,6 +19,12 @@
 import de.ids_mannheim.korap.entity.Resource;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 
+/** Parser for extracting data from free-resources.json containing
+ * listing free (non-licensed) corpora.
+ * 
+ * @author margaretha
+ *
+ */
 @Component
 public class FreeResourceParser {
     private Logger log = LogManager.getLogger(FreeResourceParser.class);
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java
index 72378be..2137ab8 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/APIAuthentication.java
@@ -25,8 +25,7 @@
 import net.sf.ehcache.Element;
 
 /**
- * EM: there is no authentication here, just implementation for
- * creating token context etc.
+ * Authentication provider using JWT tokens
  * 
  * Created by hanl on 5/23/14.
  */
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java
index a180921..7a8e295 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/OAuth2Authentication.java
@@ -15,6 +15,11 @@
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.user.User;
 
+/** Authentication provider for Bearer tokens
+ * 
+ * @author margaretha
+ *
+ */
 @Component
 public class OAuth2Authentication implements AuthenticationIface {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java b/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java
index e59d21f..a5fab90 100644
--- a/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java
+++ b/full/src/main/java/de/ids_mannheim/korap/authentication/SessionAuthentication.java
@@ -1,22 +1,21 @@
 package de.ids_mannheim.korap.authentication;
 
-import de.ids_mannheim.korap.config.KustvaktConfiguration;
-import de.ids_mannheim.korap.constant.TokenType;
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
-import de.ids_mannheim.korap.interfaces.EncryptionIface;
-import de.ids_mannheim.korap.security.context.TokenContext;
-import de.ids_mannheim.korap.config.Attributes;
-import de.ids_mannheim.korap.user.User;
-import de.ids_mannheim.korap.utils.TimeUtils;
+import java.util.Map;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.joda.time.DateTime;
 
-import java.util.Map;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
+import de.ids_mannheim.korap.config.Attributes;
+import de.ids_mannheim.korap.config.KustvaktConfiguration;
+import de.ids_mannheim.korap.constant.TokenType;
+import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.interfaces.EncryptionIface;
+import de.ids_mannheim.korap.security.context.TokenContext;
+import de.ids_mannheim.korap.user.User;
+import de.ids_mannheim.korap.utils.TimeUtils;
 
 /**
  * implementation of the AuthenticationIface to handle korap
diff --git a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
index 4d710ef..de7ac08 100644
--- a/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
+++ b/full/src/main/java/de/ids_mannheim/korap/config/NamedVCLoader.java
@@ -24,6 +24,11 @@
 import de.ids_mannheim.korap.util.QueryException;
 import de.ids_mannheim.korap.web.SearchKrill;
 
+/** Loads predefined virtual corpora at server start up and cache them.
+ * 
+ * @author margaretha
+ *
+ */
 @Component
 public class NamedVCLoader implements Runnable{
     @Autowired
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java b/full/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java
index c9b5229..11ed922 100644
--- a/full/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java
+++ b/full/src/main/java/de/ids_mannheim/korap/constant/GroupMemberStatus.java
@@ -1,6 +1,6 @@
 package de.ids_mannheim.korap.constant;
 
-/** Defines the status of a user-group member
+/** Defines possible statuses of a user-group member
  * 
  * @author margaretha
  *
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java b/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java
index 0b0ab0d..437038c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java
+++ b/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusAccessStatus.java
@@ -2,7 +2,7 @@
 
 import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
 
-/** Defines possible statusess of {@link VirtualCorpusAccess}
+/** Defines possible statuses of {@link VirtualCorpusAccess}
  * 
  * @author margaretha
  * @see VirtualCorpusAccess
diff --git a/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusType.java b/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusType.java
index 229eec2..3d6b4fa 100644
--- a/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusType.java
+++ b/full/src/main/java/de/ids_mannheim/korap/constant/VirtualCorpusType.java
@@ -8,13 +8,22 @@
  *
  */
 public enum VirtualCorpusType {
-    // available for all
+    /**
+     * available for all
+     */
     SYSTEM, 
-    // available to project group members
+    // 
+    /** available to project group members
+     * 
+     */
     PROJECT, 
-    // available only for the creator
+    /**
+     * available only for the creator
+     */
     PRIVATE, 
-    // available for all, but not listed for all
+    /**
+     * available for all, but not listed for all 
+     */
     PUBLISHED;
     
     public String displayName () {
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/AdminDaoImpl.java b/full/src/main/java/de/ids_mannheim/korap/dao/AdminDaoImpl.java
index 62d8e02..249f144 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/AdminDaoImpl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/AdminDaoImpl.java
@@ -17,6 +17,8 @@
 import de.ids_mannheim.korap.user.User;
 
 /**
+ * Describes database queries and transactions regarding admin users.
+ * 
  * @author margaretha
  *
  */
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/PrivilegeDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/PrivilegeDao.java
index 80a52a2..9bdb351 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/PrivilegeDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/PrivilegeDao.java
@@ -18,8 +18,9 @@
 import de.ids_mannheim.korap.entity.Role;
 import de.ids_mannheim.korap.entity.Role_;
 
-/** Manages database transactions regarding {@link Privilege} entity or 
- *  database table.
+/**
+ * Manages database queries and transactions regarding
+ * {@link Privilege} entity or database table.
  * 
  * @see Privilege
  * @see PrivilegeType
@@ -34,7 +35,7 @@
 
     @PersistenceContext
     private EntityManager entityManager;
-    
+
     public void addPrivilegesToRole (Role role,
             List<PrivilegeType> privilegeTypes) {
         for (PrivilegeType type : privilegeTypes) {
@@ -46,8 +47,8 @@
     public void deletePrivilegeFromRole (int roleId,
             PrivilegeType privilegeType) {
         List<Privilege> privilegeList = retrievePrivilegeByRoleId(roleId);
-        for (Privilege p: privilegeList){
-            if (p.getName().equals(privilegeType)){
+        for (Privilege p : privilegeList) {
+            if (p.getName().equals(privilegeType)) {
                 entityManager.remove(p);
                 break;
             }
@@ -66,6 +67,6 @@
         query.where(criteriaBuilder
                 .equal(root.get(Privilege_.role).get(Role_.id), roleId));
         Query q = entityManager.createQuery(query);
-       return q.getResultList();
+        return q.getResultList();
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/RoleDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/RoleDao.java
index bd24b21..0467893 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/RoleDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/RoleDao.java
@@ -22,7 +22,9 @@
 import de.ids_mannheim.korap.entity.UserGroupMember;
 import de.ids_mannheim.korap.entity.UserGroupMember_;
 
-/** Manages database transactions regarding {@link Role} entity or database table. 
+/**
+ * Manages database queries and transactions regarding {@link Role}
+ * entity or database table.
  * 
  * @author margaretha
  * @see Role
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
index 2e59379..691eaca 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupDao.java
@@ -36,8 +36,9 @@
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
-/** Manages database transactions regarding {@link UserGroup} entity and 
- *  database table.
+/**
+ * Manages database queries and transactions regarding
+ * {@link UserGroup} entity and database table.
  * 
  * @author margaretha
  * 
@@ -117,14 +118,18 @@
         entityManager.merge(group);
     }
 
-    /** Retrieves the UserGroup by the given group id. This methods does not 
-     *  fetch group members because only group admin is allowed to see them. 
-     *  Group members have to be retrieved separately.
+    /**
+     * Retrieves the UserGroup by the given group id. This methods
+     * does not
+     * fetch group members because only group admin is allowed to see
+     * them.
+     * Group members have to be retrieved separately.
      * 
      * @see UserGroupMember
-     * @param groupId group id
+     * @param groupId
+     *            group id
      * @return UserGroup
-     * @throws KustvaktException 
+     * @throws KustvaktException
      */
     public UserGroup retrieveGroupById (int groupId) throws KustvaktException {
         return retrieveGroupById(groupId, false);
@@ -156,10 +161,12 @@
         }
     }
 
-
-    /** Retrieves only user-groups that are active (not hidden or deleted).
+    /**
+     * Retrieves only user-groups that are active (not hidden or
+     * deleted).
      * 
-     * @param userId user id
+     * @param userId
+     *            user id
      * @return a list of UserGroup
      * @throws KustvaktException
      */
@@ -183,9 +190,8 @@
                         userId),
                 criteriaBuilder.notEqual(members.get(UserGroupMember_.status),
                         GroupMemberStatus.DELETED));
-        //                criteriaBuilder.equal(members.get(UserGroupMember_.status),
-        //                        GroupMemberStatus.ACTIVE));
-
+        // criteriaBuilder.equal(members.get(UserGroupMember_.status),
+        // GroupMemberStatus.ACTIVE));
 
         query.select(root);
         query.where(restrictions);
@@ -261,7 +267,9 @@
 
     }
 
-    /** This is an admin function. It retrieves all groups given the userId 
+    /**
+     * This is an admin function. It retrieves all groups given the
+     * userId
      * and status.
      * 
      * @param userId
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
index 6d1975e..cbfabd7 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/UserGroupMemberDao.java
@@ -25,7 +25,9 @@
 import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
-/** Manages database transactions regarding {@link UserGroupMember} entity and 
+/**
+ * Manages database queries and transactions regarding
+ * {@link UserGroupMember} entity and
  * database table.
  * 
  * @author margaretha
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java
index 3df91d3..9e6a7eb 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusAccessDao.java
@@ -25,8 +25,10 @@
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
-/** Manages database transactions regarding {@link VirtualCorpusAccess} entity 
- *  and its corresponding database table.
+/**
+ * Manages database queries and transactions regarding
+ * {@link VirtualCorpusAccess} entity and its corresponding database
+ * table.
  * 
  * @author margaretha
  *
@@ -148,11 +150,13 @@
         return q.getResultList();
     }
 
-    /** Hidden accesses are only created for published or system VC. 
+    /**
+     * Hidden accesses are only created for published or system VC.
      * 
      * Warn: The actual hidden accesses are not checked.
      * 
-     * @param vcId vcId 
+     * @param vcId
+     *            vcId
      * @return true if there is a hidden access, false otherwise
      * @throws KustvaktException
      */
@@ -173,10 +177,10 @@
                 builder.equal(accessVC.get(VirtualCorpus_.id), vcId),
                 builder.equal(access.get(VirtualCorpusAccess_.status),
                         VirtualCorpusAccessStatus.HIDDEN)
-//                ,
-//                builder.notEqual(access.get(VirtualCorpusAccess_.deletedBy),
-//                        "NULL")
-                );
+        // ,
+        // builder.notEqual(access.get(VirtualCorpusAccess_.deletedBy),
+        // "NULL")
+        );
 
         query.select(access);
         query.where(p);
@@ -203,9 +207,9 @@
 
     public void deleteAccess (VirtualCorpusAccess access, String deletedBy) {
         // soft delete
-        
+
         // hard delete
-        if (!entityManager.contains(access)){
+        if (!entityManager.contains(access)) {
             access = entityManager.merge(access);
         }
         entityManager.remove(access);
diff --git a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
index ab4fbb8..0a16309 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dao/VirtualCorpusDao.java
@@ -38,8 +38,9 @@
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
 /**
- * VirtualCorpusDao manages SQL queries regarding virtual corpora,
- * e.g. retrieving and storing virtual corpora.
+ * VirtualCorpusDao manages database queries and transactions
+ * regarding virtual corpora, e.g. retrieving and storing virtual
+ * corpora.
  * 
  * @author margaretha
  *
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/ResourceDto.java b/full/src/main/java/de/ids_mannheim/korap/dto/ResourceDto.java
index 8b03ec9..27952a6 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/ResourceDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/ResourceDto.java
@@ -6,7 +6,8 @@
 import lombok.Setter;
 
 /**
- * Data transfer object for resource description (e.g. for KorapSRU).
+ * Data transfer object for resource / corpus description (e.g. for
+ * KorapSRU).
  * 
  * @author margaretha
  *
@@ -21,7 +22,6 @@
     private String[] languages;
     private Map<Integer, String> layers;
 
-
     @Override
     public String toString () {
         return "resourceId= " + resourceId + ", description= " + description
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java b/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java
index 74d0df6..5e8a6e7 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/VirtualCorpusAccessDto.java
@@ -4,6 +4,9 @@
 import lombok.Setter;
 
 /**
+ * Defines the structure of virtual corpus accesses, e.g. as JSON
+ * objects in HTTP Responses.
+ * 
  * @author margaretha
  *
  */
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java
index 5f8d0cb..da5c2d3 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java
@@ -13,10 +13,8 @@
 
 /**
  * ResourceConverter prepares data transfer objects (DTOs) from
- * {@link Resource}
- * entities. DTO structure defines controllers output, namely the
- * structure of
- * JSON objects in HTTP responses.
+ * {@link Resource} entities. DTO structure defines controllers
+ * output, namely the structure of JSON objects in HTTP responses.
  * 
  * @author margaretha
  *
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
index 3978799..cadedf9 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
@@ -14,9 +14,11 @@
 import de.ids_mannheim.korap.entity.UserGroupMember;
 import edu.emory.mathcs.backport.java.util.Collections;
 
-/** Manages conversion of  {@link UserGroup} objects to their data access objects (DTO), 
- * e.g. UserGroupDto. DTO structure defines controllers output, namely the structure of 
- * JSON objects in HTTP responses.
+/**
+ * UserGroupConverter manages conversion of {@link UserGroup} objects
+ * to their data access objects (DTO), e.g. UserGroupDto. DTO
+ * structure defines controllers output, namely the structure of JSON
+ * objects in HTTP responses.
  * 
  * @author margaretha
  *
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java
index abd2dab..74ebeec 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusAccessConverter.java
@@ -7,10 +7,12 @@
 
 import de.ids_mannheim.korap.dto.VirtualCorpusAccessDto;
 import de.ids_mannheim.korap.entity.VirtualCorpusAccess;
+
 /**
- * VirtualCorpusAccessConverter prepares data transfer objects (DTOs) from {@link VirtualCorpusAccess}
- * entities. DTO structure defines controllers output, namely the structure of 
- * JSON objects in HTTP responses.
+ * VirtualCorpusAccessConverter prepares data transfer objects (DTOs)
+ * from {@link VirtualCorpusAccess} entities. DTO structure defines
+ * controllers output, namely the structure of JSON objects in HTTP
+ * responses.
  * 
  * @author margaretha
  *
@@ -18,22 +20,23 @@
 @Component
 public class VirtualCorpusAccessConverter {
 
-    public List<VirtualCorpusAccessDto> createVCADto (List<VirtualCorpusAccess> accessList) {
+    public List<VirtualCorpusAccessDto> createVCADto (
+            List<VirtualCorpusAccess> accessList) {
         List<VirtualCorpusAccessDto> dtos = new ArrayList<>(accessList.size());
-        for (VirtualCorpusAccess access : accessList){
+        for (VirtualCorpusAccess access : accessList) {
             VirtualCorpusAccessDto dto = new VirtualCorpusAccessDto();
             dto.setAccessId(access.getId());
             dto.setCreatedBy(access.getCreatedBy());
-            
+
             dto.setVcId(access.getVirtualCorpus().getId());
             dto.setVcName(access.getVirtualCorpus().getName());
-            
+
             dto.setUserGroupId(access.getUserGroup().getId());
             dto.setUserGroupName(access.getUserGroup().getName());
-            
+
             dtos.add(dto);
         }
         return dtos;
     }
-    
+
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
index 9fec23d..7a13e89 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
@@ -10,9 +10,9 @@
 import de.ids_mannheim.korap.utils.JsonUtils;
 
 /**
- * VirtualCorpusConverter prepares data transfer objects (DTOs) from {@link VirtualCorpus}
- * entities. DTO structure defines controllers output, namely the structure of 
- * JSON objects in HTTP responses.
+ * VirtualCorpusConverter prepares data transfer objects (DTOs) from
+ * {@link VirtualCorpus} entities. DTO structure defines controllers
+ * output, namely the structure of JSON objects in HTTP responses.
  * 
  * @author margaretha
  *
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/Privilege.java b/full/src/main/java/de/ids_mannheim/korap/entity/Privilege.java
index 2254e5d..9838f8a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/Privilege.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/Privilege.java
@@ -15,7 +15,8 @@
 import lombok.Getter;
 import lombok.Setter;
 
-/**  
+/**
+ * Describes privilege table listing users and their roles.
  * 
  * @author margaretha
  *
@@ -23,7 +24,7 @@
 @Getter
 @Setter
 @Entity
-@Table(name="privilege")
+@Table(name = "privilege")
 public class Privilege {
 
     @Id
@@ -31,11 +32,12 @@
     private int id;
     @Enumerated(EnumType.STRING)
     private PrivilegeType name;
-    @ManyToOne(fetch=FetchType.LAZY)
+    @ManyToOne(fetch = FetchType.LAZY)
     @JoinColumn(name = "role_id", referencedColumnName = "id")
     private Role role;
 
     public Privilege () {}
+
     public Privilege (PrivilegeType name, Role role) {
         this.name = name;
         this.role = role;
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java b/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
index 568e674..3705719 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/UserGroup.java
@@ -18,14 +18,17 @@
 import lombok.Getter;
 import lombok.Setter;
 
-/** Describes user groups.
+/**
+ * Describes user group table and its relations to UserGroupMember and
+ * VirtualCorpusAccess.
  * 
- * Any user may create a user group and send invitations to group 
+ * Any user may create a user group and send invitations to group
  * member by username. Any group member may reject the invitation
  * or unsubscribe from the group.
  * 
  * @author margaretha
  * @see UserGroupMember
+ * @see VirtualCorpusAccess
  */
 @Setter
 @Getter
@@ -54,13 +57,11 @@
             cascade = CascadeType.REMOVE)
     private List<VirtualCorpusAccess> virtualCorpusAccess;
 
-
     @Override
     public String toString () {
         return "id=" + id + ", name= " + name + ", createdBy= " + createdBy;
     }
 
-
     @Override
     public int compareTo (UserGroup o) {
         if (this.getId() > o.getId()) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java b/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
index 4a6aeeb..24bdc6d 100644
--- a/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
+++ b/full/src/main/java/de/ids_mannheim/korap/entity/VirtualCorpus.java
@@ -19,12 +19,14 @@
 import lombok.Getter;
 import lombok.Setter;
 
-/** Describes virtual corpora.
+/**
+ * Describes the virtual corpora table and its relation to
+ * VirtualCorpusAccess.
  * 
- *  Any user may create a virtual corpus and share it to a user group.
- *  However, if the user is not a user-group admin, the virtual corpus 
- *  will not be shared until a user-group admin accept his/her request.
- *   
+ * Any user may create a virtual corpus and share it to a user group.
+ * However, if the user is not a user-group admin, the virtual corpus
+ * will not be shared until a user-group admin accept his/her request.
+ * 
  * @author margaretha
  *
  * @see VirtualCorpusAccess
@@ -34,7 +36,7 @@
 @Getter
 @Entity
 @Table(name = "virtual_corpus")
-public class VirtualCorpus implements Comparable<VirtualCorpus>{
+public class VirtualCorpus implements Comparable<VirtualCorpus> {
 
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2ClientType.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2ClientType.java
index 60209be..dd1da81 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2ClientType.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2ClientType.java
@@ -1,20 +1,32 @@
 package de.ids_mannheim.korap.oauth2.constant;
 
+/**
+ * Defines possible OAuth2 client types.
+ * 
+ * Quoted from RFC 6749:
+ * <ul> 
+ * 
+ * <li> <b>Confidential clients</b> are clients capable of maintaining
+ * the confidentiality of their
+ * credentials (e.g., client implemented on a secure server with
+ * restricted access to the client credentials), or capable of secure
+ * client authentication using other means.
+ * </li>
+ * 
+ * <li>
+ * <b>Public clients</b> are Clients incapable of maintaining the
+ * confidentiality of their credentials (e.g., clients executing on
+ * the device used by the resource owner, such as an installed
+ * native application or a web browser-based application), and
+ * incapable of secure client authentication via any other means.
+ * Mobile and Javascript apps are considered public clients.
+ * </li>
+ * </ul>
+ * 
+ * @author margaretha
+ *
+ */
 public enum OAuth2ClientType {
 
-    // EM: from RFC 6749
-        
-//    Clients capable of maintaining the confidentiality of their
-//    credentials (e.g., client implemented on a secure server with
-//    restricted access to the client credentials), or capable of secure
-//    client authentication using other means.
-    CONFIDENTIAL, 
-    
-//    Clients incapable of maintaining the confidentiality of their
-//    credentials (e.g., clients executing on the device used by the
-//    resource owner, such as an installed native application or a web
-//    browser-based application), and incapable of secure client
-//    authentication via any other means. Mobile and Javascript apps 
-//    are considered public clients. 
-    PUBLIC;
+    CONFIDENTIAL, PUBLIC;
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2Error.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2Error.java
index fbdb5a7..4b76a26 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2Error.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/constant/OAuth2Error.java
@@ -1,12 +1,17 @@
 package de.ids_mannheim.korap.oauth2.constant;
 
+/**
+ * Lists possible OAuth2 errors as described in RFC 6749 and 6750.
+ * 
+ * @author margaretha
+ *
+ */
 public class OAuth2Error {
 
     public static final String ERROR = "error";
     public static final String DESCRIPTION = "error_description";
     public static final String URI = "error_uri";
 
-
     /**
      * The request is missing a required parameter, includes an
      * invalid parameter value, includes a parameter more than
@@ -92,12 +97,22 @@
     public static final String TEMPORARILY_UNAVAILABLE =
             "temporarily_unavailable";
 
-
-    // extensions
-    
+    /**
+     * The request requires higher privileges than provided by the
+     * access token.
+     */
     public static final String INSUFFICIENT_SCOPE = "insufficient_scope";
 
+    /**
+     * The access token provided is revoked, malformed, or
+     * invalid for other reasons.
+     */
     public static final String INVALID_TOKEN = "invalid_token";
 
+    /**
+     * The access token provided is expired. This error is a
+     * specialization of invalid_token error and not part of
+     * the RFCs.
+     */
     public static final String EXPIRED_TOKEN = "expired_token";
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessScopeDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessScopeDao.java
index a714420..aeb1c92 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessScopeDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessScopeDao.java
@@ -16,6 +16,13 @@
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.oauth2.entity.AccessScope;
 
+/**
+ * AccessScopeDao manages database queries and transactions regarding
+ * access scopes.
+ * 
+ * @author margaretha
+ *
+ */
 @Repository
 @Transactional
 public class AccessScopeDao {
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java
index b5f4173..3a9b585 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AccessTokenDao.java
@@ -34,6 +34,12 @@
 import de.ids_mannheim.korap.oauth2.entity.RefreshToken_;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
+/**
+ * Manages database queries and transactions regarding access tokens.
+ * 
+ * @author margaretha
+ *
+ */
 @Repository
 @Transactional
 public class AccessTokenDao extends KustvaktCacheable {
@@ -129,7 +135,8 @@
         CriteriaQuery<RefreshToken> query =
                 builder.createQuery(RefreshToken.class);
         Root<RefreshToken> root = query.from(RefreshToken.class);
-        Join<RefreshToken, OAuth2Client> client = root.join(RefreshToken_.client);
+        Join<RefreshToken, OAuth2Client> client =
+                root.join(RefreshToken_.client);
         query.select(root);
         query.where(builder.equal(client.get(OAuth2Client_.id), clientId));
         TypedQuery<RefreshToken> q = entityManager.createQuery(query);
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDao.java
index aa05d5d..b145f44 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDao.java
@@ -8,17 +8,26 @@
 import de.ids_mannheim.korap.oauth2.entity.AccessScope;
 import de.ids_mannheim.korap.oauth2.entity.Authorization;
 
+/**
+ * AuthorizationDao is an interface describing methods for managing
+ * authorizations.
+ * 
+ * @author margaretha
+ *
+ */
 public interface AuthorizationDao {
 
     public Authorization storeAuthorizationCode (String clientId, String userId,
             String code, Set<AccessScope> scopes, String redirectURI,
-            ZonedDateTime authenticationTime, String nonce) throws KustvaktException;
-    
+            ZonedDateTime authenticationTime, String nonce)
+            throws KustvaktException;
+
     public Authorization retrieveAuthorizationCode (String code)
             throws KustvaktException;
-    
+
     public Authorization updateAuthorization (Authorization authorization)
             throws KustvaktException;
 
-    public List<Authorization> retrieveAuthorizationsByClientId (String clientId);
+    public List<Authorization> retrieveAuthorizationsByClientId (
+            String clientId);
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java
index 538c655..2cc570b 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/AuthorizationDaoImpl.java
@@ -27,6 +27,13 @@
 import de.ids_mannheim.korap.oauth2.entity.Authorization_;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
+/**
+ * Implementations of {@link AuthorizationDao} managing database
+ * queries and transactions regarding OAuth2 authorizations.
+ * 
+ * @author margaretha
+ *
+ */
 @Transactional
 @Repository
 public class AuthorizationDaoImpl implements AuthorizationDao {
@@ -35,7 +42,7 @@
     private EntityManager entityManager;
     @Autowired
     private FullConfiguration config;
-    
+
     public Authorization storeAuthorizationCode (String clientId, String userId,
             String code, Set<AccessScope> scopes, String redirectURI,
             ZonedDateTime authenticationTime, String nonce)
@@ -55,7 +62,7 @@
         authorization.setRedirectURI(redirectURI);
         authorization.setUserAuthenticationTime(authenticationTime);
         authorization.setNonce(nonce);
-        
+
         ZonedDateTime now =
                 ZonedDateTime.now(ZoneId.of(Attributes.DEFAULT_TIME_ZONE));
         authorization.setCreatedDate(now);
@@ -101,7 +108,8 @@
 
     @SuppressWarnings("unchecked")
     @Override
-    public List<Authorization> retrieveAuthorizationsByClientId (String clientId) {
+    public List<Authorization> retrieveAuthorizationsByClientId (
+            String clientId) {
         CriteriaBuilder builder = entityManager.getCriteriaBuilder();
         CriteriaQuery<Authorization> query =
                 builder.createQuery(Authorization.class);
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java
index ed848bc..9c807c2 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/CachedAuthorizationDaoImpl.java
@@ -20,6 +20,13 @@
 import de.ids_mannheim.korap.utils.ParameterChecker;
 import net.sf.ehcache.Element;
 
+/**
+ * Implementations of {@link AuthorizationDao} using a cache instead
+ * of a database.
+ * 
+ * @author margaretha
+ *
+ */
 public class CachedAuthorizationDaoImpl extends KustvaktCacheable
         implements AuthorizationDao {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java
index 7bde510..a3507b7 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/OAuth2ClientDao.java
@@ -29,6 +29,11 @@
 import de.ids_mannheim.korap.oauth2.entity.RefreshToken_;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
+/** Manages database queries and transactions regarding OAuth2 clients. 
+ * 
+ * @author margaretha
+ *
+ */
 @Transactional
 @Repository
 public class OAuth2ClientDao {
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java
index 8ee798b..87c7a6d 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dao/RefreshTokenDao.java
@@ -28,6 +28,12 @@
 import de.ids_mannheim.korap.oauth2.entity.RefreshToken_;
 import de.ids_mannheim.korap.utils.ParameterChecker;
 
+/**
+ * Manages database queries and transactions regarding refresh tokens.
+ * 
+ * @author margaretha
+ *
+ */
 @Repository
 @Transactional
 public class RefreshTokenDao {
@@ -71,7 +77,7 @@
                 builder.createQuery(RefreshToken.class);
         Root<RefreshToken> root = query.from(RefreshToken.class);
         root.fetch(RefreshToken_.client);
-        
+
         query.select(root);
         query.where(builder.equal(root.get(RefreshToken_.token), token));
         Query q = entityManager.createQuery(query);
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientDto.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientDto.java
index 3f6199b..fccffb8 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientDto.java
@@ -3,6 +3,13 @@
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 
+/**
+ * Describes the client_id and the client_secret of a client after
+ * client registration or reset secret.
+ * 
+ * @author margaretha
+ *
+ */
 @JsonInclude(Include.NON_EMPTY)
 public class OAuth2ClientDto {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java
index 85003ae..3970c8d 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2ClientInfoDto.java
@@ -6,6 +6,11 @@
 import de.ids_mannheim.korap.oauth2.constant.OAuth2ClientType;
 import de.ids_mannheim.korap.oauth2.entity.OAuth2Client;
 
+/** Describes information about an OAuth2 client.
+ * 
+ * @author margaretha
+ *
+ */
 @JsonInclude(Include.NON_EMPTY)
 public class OAuth2ClientInfoDto {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java
index 02ab148..3fa44b5 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/dto/OAuth2UserClientDto.java
@@ -1,5 +1,10 @@
 package de.ids_mannheim.korap.oauth2.dto;
 
+/** Lists authorized OAuth2 clients of a user
+ * 
+ * @author margaretha
+ *
+ */
 public class OAuth2UserClientDto {
     
     private String clientId;
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessScope.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessScope.java
index 15d9da5..5a8a498 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessScope.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessScope.java
@@ -15,11 +15,18 @@
 import lombok.Getter;
 import lombok.Setter;
 
+/**
+ * Defines the oauth2_access_scope database table mapping and access
+ * scope relations to Authorization, AccessToken and RefreshToken.
+ * 
+ * @author margaretha
+ *
+ */
 @Getter
 @Setter
 @Entity
 @Table(name = "oauth2_access_scope")
-public class AccessScope implements Serializable{
+public class AccessScope implements Serializable {
 
     private static final long serialVersionUID = -7356877266702636705L;
 
@@ -35,10 +42,10 @@
 
     @ManyToMany(mappedBy = "scopes", fetch = FetchType.LAZY)
     private List<Authorization> authorizations;
-    
+
     @ManyToMany(mappedBy = "scopes", fetch = FetchType.LAZY)
     private List<AccessToken> accessTokens;
-    
+
     @ManyToMany(mappedBy = "scopes", fetch = FetchType.LAZY)
     private List<RefreshToken> refreshTokens;
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessToken.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessToken.java
index ba381de..a94b081 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessToken.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/AccessToken.java
@@ -20,6 +20,13 @@
 import lombok.Getter;
 import lombok.Setter;
 
+/**
+ * Defines oauth2_access_token database table mapping and access token
+ * relations to AccessScope and RefreshToken.
+ * 
+ * @author margaretha
+ *
+ */
 @Getter
 @Setter
 @Entity
@@ -59,7 +66,7 @@
                     columnNames = { "token_id", "scope_id" }))
     private Set<AccessScope> scopes;
 
-    @ManyToOne(fetch=FetchType.LAZY)
-    @JoinColumn(name="refresh_token")
+    @ManyToOne(fetch = FetchType.LAZY)
+    @JoinColumn(name = "refresh_token")
     private RefreshToken refreshToken;
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/Authorization.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/Authorization.java
index bb38fb5..76813ff 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/Authorization.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/Authorization.java
@@ -18,6 +18,13 @@
 import lombok.Getter;
 import lombok.Setter;
 
+/**
+ * Describes oauth2_authorization database table mapping and
+ * authorization relations to AccessScope.
+ * 
+ * @author margaretha
+ *
+ */
 @Getter
 @Setter
 @Entity
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2Client.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2Client.java
index 8023e32..5e2c929 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2Client.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2Client.java
@@ -16,7 +16,8 @@
 
 import de.ids_mannheim.korap.oauth2.constant.OAuth2ClientType;
 
-/**
+/** Describe oauth2_client database table mapping.
+ * 
  * @author margaretha
  *
  */
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2ClientUrl.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2ClientUrl.java
index 3396d0b..0ab27c1 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2ClientUrl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/OAuth2ClientUrl.java
@@ -8,7 +8,8 @@
 import lombok.Getter;
 import lombok.Setter;
 
-/**
+/** Describes oauth2_client_url database table mapping
+ * 
  * @author margaretha
  *
  */
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/RefreshToken.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/RefreshToken.java
index a60aef5..4830468 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/RefreshToken.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/entity/RefreshToken.java
@@ -17,6 +17,13 @@
 import javax.persistence.Table;
 import javax.persistence.UniqueConstraint;
 
+/**
+ * Describes oauth2_refresh_token database table mapping and refresh
+ * token relations to access scopes, access tokens, and oauth2 clients.
+ * 
+ * @author margaretha
+ *
+ */
 @Entity
 @Table(name = "oauth2_refresh_token")
 public class RefreshToken {
@@ -31,8 +38,8 @@
     private ZonedDateTime expiryDate;
     @Column(name = "user_id")
     private String userId;
-//    @Column(name = "client_id")
-//    private String clientId;
+    // @Column(name = "client_id")
+    // private String clientId;
     @Column(name = "user_auth_time", updatable = false)
     private ZonedDateTime userAuthenticationTime;
     @Column(name = "is_revoked")
@@ -40,9 +47,9 @@
 
     @OneToMany(fetch = FetchType.EAGER, mappedBy = "refreshToken")
     private Set<AccessToken> accessTokens;
-    
-    @ManyToOne(fetch=FetchType.LAZY)
-    @JoinColumn(name="client")
+
+    @ManyToOne(fetch = FetchType.LAZY)
+    @JoinColumn(name = "client")
     private OAuth2Client client;
 
     @ManyToMany(fetch = FetchType.EAGER)
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/OAuth2RevokeTokenSuperRequest.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/OAuth2RevokeTokenSuperRequest.java
index 183d2a3..347a233 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/OAuth2RevokeTokenSuperRequest.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/OAuth2RevokeTokenSuperRequest.java
@@ -5,12 +5,20 @@
 
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.oltu.oauth2.as.request.OAuthRequest;
 import org.apache.oltu.oauth2.common.OAuth;
 import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
 import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
 import org.apache.oltu.oauth2.common.utils.OAuthUtils;
 import org.apache.oltu.oauth2.common.validators.OAuthValidator;
 
+/**
+ * A custom request based on {@link OAuthRequest}. It defines token
+ * revocation request that should have been sent from a super client.
+ * 
+ * @author margaretha
+ *
+ */
 public class OAuth2RevokeTokenSuperRequest {
     protected HttpServletRequest request;
     protected OAuthValidator<HttpServletRequest> validator;
@@ -49,13 +57,13 @@
     public String getClientId () {
         return request.getParameter(OAuth.OAUTH_CLIENT_ID);
     }
-    
+
     public String getSuperClientId () {
         return request.getParameter(RevokeTokenSuperValidator.SUPER_CLIENT_ID);
     }
-    
+
     public String getSuperClientSecret () {
-        return request.getParameter(RevokeTokenSuperValidator.
-                SUPER_CLIENT_SECRET);
+        return request
+                .getParameter(RevokeTokenSuperValidator.SUPER_CLIENT_SECRET);
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/RevokeTokenSuperValidator.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/RevokeTokenSuperValidator.java
index 650e8a5..454f0e5 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/RevokeTokenSuperValidator.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/RevokeTokenSuperValidator.java
@@ -12,6 +12,13 @@
 
 import de.ids_mannheim.korap.oauth2.constant.OAuth2Error;
 
+/**
+ * Defines required request parameters for
+ * OAuth2RevokeTokenSuperRequest and validates the request method.
+ * 
+ * @author margaretha
+ *
+ */
 public class RevokeTokenSuperValidator
         extends AbstractValidator<HttpServletRequest> {
 
@@ -42,12 +49,10 @@
         if (enforceClientAuthentication) {
             Set<String> missingParameters = new HashSet<String>();
 
-            if (OAuthUtils
-                    .isEmpty(request.getParameter(SUPER_CLIENT_ID))) {
+            if (OAuthUtils.isEmpty(request.getParameter(SUPER_CLIENT_ID))) {
                 missingParameters.add(SUPER_CLIENT_ID);
             }
-            if (OAuthUtils
-                    .isEmpty(request.getParameter(SUPER_CLIENT_SECRET))) {
+            if (OAuthUtils.isEmpty(request.getParameter(SUPER_CLIENT_SECRET))) {
                 missingParameters.add(SUPER_CLIENT_SECRET);
             }
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuTokenService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuTokenService.java
index a88355e..f7d6405 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuTokenService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/oltu/service/OltuTokenService.java
@@ -34,6 +34,11 @@
 import de.ids_mannheim.korap.oauth2.oltu.OAuth2RevokeTokenSuperRequest;
 import de.ids_mannheim.korap.oauth2.service.OAuth2TokenService;
 
+/** Implementation of token service using Apache Oltu.
+ * 
+ * @author margaretha
+ *
+ */
 @Service
 public class OltuTokenService extends OAuth2TokenService {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/OpenIdHttpRequestWrapper.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/OpenIdHttpRequestWrapper.java
index 8f6d80b..a489ef6 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/OpenIdHttpRequestWrapper.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/OpenIdHttpRequestWrapper.java
@@ -9,6 +9,11 @@
 import com.nimbusds.oauth2.sdk.ParseException;
 import com.nimbusds.oauth2.sdk.http.HTTPRequest;
 
+/** A request wrapper based on HTTPRequest.
+ * 
+ * @author margaretha
+ *
+ */
 public class OpenIdHttpRequestWrapper extends HTTPRequest {
 
     private Map<String, String> params;
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/JWKService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/JWKService.java
index c157662..df9fb17 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/JWKService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/JWKService.java
@@ -20,6 +20,11 @@
 
 import de.ids_mannheim.korap.config.FullConfiguration;
 
+/** JWK services for generating key pair and key set.
+ * 
+ * @author margaretha
+ *
+ */
 @Service
 public class JWKService {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdAuthorizationService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdAuthorizationService.java
index 5997ca0..2d3ee33 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdAuthorizationService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdAuthorizationService.java
@@ -31,6 +31,11 @@
 import de.ids_mannheim.korap.oauth2.entity.OAuth2Client;
 import de.ids_mannheim.korap.oauth2.service.OAuth2AuthorizationService;
 
+/** Authorization service implementation using open id. 
+ * 
+ * @author margaretha
+ *
+ */
 @Service
 public class OpenIdAuthorizationService extends OAuth2AuthorizationService {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdConfigService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdConfigService.java
index 0820f3f..bcec0fa 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdConfigService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdConfigService.java
@@ -6,6 +6,10 @@
 import de.ids_mannheim.korap.config.FullConfiguration;
 import de.ids_mannheim.korap.oauth2.openid.OpenIdConfiguration;
 
+/**
+ * @author margaretha
+ *
+ */
 @Service
 public class OpenIdConfigService {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdTokenService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdTokenService.java
index 15570e1..3da8545 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdTokenService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/openid/service/OpenIdTokenService.java
@@ -55,6 +55,8 @@
 import de.ids_mannheim.korap.utils.TimeUtils;
 
 /**
+ * Token service implementation using OpenId.
+ * 
  * ID Tokens MUST be signed using JWS and optionally both signed and
  * then encrypted using JWS [JWS] and JWE [JWE] respectively.
  * 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2AuthorizationService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2AuthorizationService.java
index 4fab78a..4a50c8a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2AuthorizationService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2AuthorizationService.java
@@ -19,6 +19,11 @@
 import de.ids_mannheim.korap.oauth2.entity.Authorization;
 import de.ids_mannheim.korap.oauth2.entity.OAuth2Client;
 
+/** Describes business logic behind OAuth2 authorization requests.
+ * 
+ * @author margaretha
+ *
+ */
 @Service(value = "authorizationService")
 public class OAuth2AuthorizationService {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
index f1e4de0..dbe097c 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ClientService.java
@@ -35,6 +35,9 @@
 import de.ids_mannheim.korap.web.input.OAuth2ClientJson;
 
 /**
+ * Defines business logic related to OAuth2 client including
+ * client registration and client authentication.
+ * 
  * According to RFC 6749, an authorization server MUST:
  * <ul>
  * <li>
diff --git a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ScopeServiceImpl.java b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ScopeServiceImpl.java
index 7632032..d2d59eb 100644
--- a/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ScopeServiceImpl.java
+++ b/full/src/main/java/de/ids_mannheim/korap/oauth2/service/OAuth2ScopeServiceImpl.java
@@ -19,9 +19,13 @@
 import de.ids_mannheim.korap.oauth2.constant.OAuth2Error;
 import de.ids_mannheim.korap.oauth2.dao.AccessScopeDao;
 import de.ids_mannheim.korap.oauth2.entity.AccessScope;
-import de.ids_mannheim.korap.oauth2.entity.AccessScope;
 import de.ids_mannheim.korap.security.context.TokenContext;
 
+/** Defines business logic related to OAuth2 scopes.
+ * 
+ * @author margaretha
+ *
+ */
 public class OAuth2ScopeServiceImpl implements OAuth2ScopeService {
 
     @Autowired
@@ -46,15 +50,16 @@
         int index;
         OAuth2Scope oauth2Scope = null;
         for (String scope : scopes) {
-            try{
-                oauth2Scope = Enum.valueOf(OAuth2Scope.class, scope.toUpperCase());
+            try {
+                oauth2Scope =
+                        Enum.valueOf(OAuth2Scope.class, scope.toUpperCase());
             }
             catch (IllegalArgumentException e) {
                 throw new KustvaktException(StatusCodes.INVALID_SCOPE,
                         scope + " is an invalid scope",
                         OAuth2Error.INVALID_SCOPE);
             }
-            
+
             index = definedScopes.indexOf(new AccessScope(oauth2Scope));
             if (index == -1) {
                 throw new KustvaktException(StatusCodes.INVALID_SCOPE,
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionConstraint.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionConstraint.java
index 19040e9..0b5caba 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionConstraint.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionConstraint.java
@@ -4,8 +4,6 @@
 
 import de.ids_mannheim.korap.config.Attributes;
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
-import de.ids_mannheim.korap.resource.rewrite.KoralNode;
-import de.ids_mannheim.korap.resource.rewrite.RewriteTask;
 import de.ids_mannheim.korap.user.User;
 
 /**
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java
index 9d3d952..71c5903 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/CollectionRewrite.java
@@ -16,9 +16,7 @@
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.object.KoralMatchOperator;
 import de.ids_mannheim.korap.query.object.KoralOperation;
-import de.ids_mannheim.korap.resource.rewrite.KoralNode;
-import de.ids_mannheim.korap.resource.rewrite.KoralNode.RewriteIdentifier;
-import de.ids_mannheim.korap.resource.rewrite.RewriteTask;
+import de.ids_mannheim.korap.rewrite.KoralNode.RewriteIdentifier;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.user.User.CorpusAccess;
 import de.ids_mannheim.korap.utils.JsonUtils;
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java
index f4c2f49..092fe9e 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/FullRewriteHandler.java
@@ -3,12 +3,9 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import de.ids_mannheim.korap.config.FullConfiguration;
-import de.ids_mannheim.korap.resource.rewrite.CollectionCleanRewrite;
-// import de.ids_mannheim.korap.resource.rewrite.IdWriter;
-import de.ids_mannheim.korap.resource.rewrite.RewriteHandler;
 
 /**
- * Defines rewrite handling methods relevant only in full version.
+ * Defines rewrite handling methods, relevant only in full version.
  * 
  * @author margaretha
  *
@@ -17,7 +14,7 @@
 
     @Autowired
     private VirtualCorpusRewrite vcRewrite;
-    
+
     public FullRewriteHandler (FullConfiguration config) {
         super(config);
     }
diff --git a/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java b/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
index 55110d0..39c76d4 100644
--- a/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
+++ b/full/src/main/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewrite.java
@@ -9,14 +9,19 @@
 import de.ids_mannheim.korap.config.KustvaktConfiguration;
 import de.ids_mannheim.korap.entity.VirtualCorpus;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.resource.rewrite.KoralNode;
-import de.ids_mannheim.korap.resource.rewrite.KoralNode.RewriteIdentifier;
-import de.ids_mannheim.korap.resource.rewrite.RewriteTask;
+import de.ids_mannheim.korap.rewrite.KoralNode.RewriteIdentifier;
 import de.ids_mannheim.korap.service.VirtualCorpusService;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.util.StatusCodes;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
+/**
+ * Rewrites virtual corpus reference with the corresponding koral
+ * query describing the actual virtual corpus query.
+ * 
+ * @author margaretha
+ *
+ */
 @Component
 public class VirtualCorpusRewrite implements RewriteTask.RewriteQuery {
 
@@ -83,7 +88,7 @@
         String ref = jsonNode.at("/ref").asText();
         koralNode.remove("ref", new RewriteIdentifier("ref", ref));
 
-        ref = ref.substring(vcOwner.length()+1, ref.length());
+        ref = ref.substring(vcOwner.length() + 1, ref.length());
         koralNode.set("ref", ref, new RewriteIdentifier("ref", ref));
     }
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/OpenIdResponseHandler.java b/full/src/main/java/de/ids_mannheim/korap/web/OpenIdResponseHandler.java
index 3729bd2..ce467a8 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/OpenIdResponseHandler.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/OpenIdResponseHandler.java
@@ -27,6 +27,11 @@
 import de.ids_mannheim.korap.oauth2.constant.OAuth2Error;
 import net.minidev.json.JSONObject;
 
+/** Generates OpenId specific responses.
+ * 
+ * @author margaretha
+ *
+ */
 @Service
 public class OpenIdResponseHandler extends KustvaktResponseHandler {
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java
index 88c8840..97dbbcd 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/AdminController.java
@@ -26,7 +26,7 @@
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AdminFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
index ed0d30d..b3594fd 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
@@ -45,7 +45,7 @@
 import de.ids_mannheim.korap.utils.ServiceInfo;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.filter.DemoUserFilter;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
index 020eb97..4ad63dc 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
@@ -28,6 +28,7 @@
 
 import de.ids_mannheim.korap.constant.OAuth2Scope;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
+import de.ids_mannheim.korap.oauth2.entity.AccessScope;
 import de.ids_mannheim.korap.oauth2.oltu.OAuth2AuthorizationRequest;
 import de.ids_mannheim.korap.oauth2.oltu.OAuth2RevokeTokenRequest;
 import de.ids_mannheim.korap.oauth2.oltu.OAuth2RevokeTokenSuperRequest;
@@ -36,11 +37,22 @@
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.web.OAuth2ResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.utils.FormRequestWrapper;
 
+/**
+ * OAuth2Controller describes OAuth2 web API for authorization
+ * for both internal (e.g Kalamar) and external (third party) clients.
+ * 
+ * Possible authorization scopes are listed in {@link OAuth2Scope} For
+ * more information about OAuth2 authorization mechanisms, see RFC
+ * 6749.
+ * 
+ * @author margaretha
+ *
+ */
 @Controller
 @Path("{version}/oauth2")
 @ResourceFilters({ APIVersionFilter.class })
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java
index 6eae61c..5b3602e 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2WithOpenIdController.java
@@ -42,14 +42,22 @@
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.web.OpenIdResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.utils.MapUtils;
 
+/**
+ * Describes OAuth2 webAPI with OpenId Connect implementation, an
+ * additional authentication protocol allowing clients to verify
+ * user authentication data represented by ID tokens.
+ * 
+ * @author margaretha
+ *
+ */
 @Controller
 @Path("{version}/oauth2/openid")
-@ResourceFilters({APIVersionFilter.class})
+@ResourceFilters({ APIVersionFilter.class })
 public class OAuth2WithOpenIdController {
 
     @Autowired
@@ -62,7 +70,7 @@
     private OpenIdConfigService configService;
     @Autowired
     private OAuth2ScopeService scopeService;
-    
+
     @Autowired
     private OpenIdResponseHandler openIdResponseHandler;
 
@@ -142,7 +150,7 @@
         URI uri = null;
         try {
             scopeService.verifyScope(tokenContext, OAuth2Scope.AUTHORIZE);
-            
+
             if (isAuthentication) {
                 authzService.checkRedirectUriParam(map);
             }
@@ -161,7 +169,6 @@
         return builder.build();
     }
 
-
     @POST
     @Path("token")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
index 38e7474..4dd7c83 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
@@ -29,7 +29,7 @@
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.web.OAuth2ResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.input.OAuth2ClientJson;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
index 0cff51e..0d15e46 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
@@ -14,7 +14,7 @@
 
 import de.ids_mannheim.korap.dto.ResourceDto;
 import de.ids_mannheim.korap.service.ResourceService;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
 
 /**
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java
index f44fb3f..d1cb539 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java
@@ -53,7 +53,7 @@
 import de.ids_mannheim.korap.utils.StringUtils;
 import de.ids_mannheim.korap.utils.TimeUtils;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.filter.DemoUserFilter;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index c356d78..314c1a6 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -29,8 +29,8 @@
 import de.ids_mannheim.korap.oauth2.service.OAuth2ScopeService;
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.service.UserGroupService;
-import de.ids_mannheim.korap.web.APIVersionFilter;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index 12ce7bf..180e319 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -31,7 +31,7 @@
 import de.ids_mannheim.korap.security.context.TokenContext;
 import de.ids_mannheim.korap.service.VirtualCorpusService;
 import de.ids_mannheim.korap.web.KustvaktResponseHandler;
-import de.ids_mannheim.korap.web.APIVersionFilter;
+import de.ids_mannheim.korap.web.filter.APIVersionFilter;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
 import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/utils/MapUtils.java b/full/src/main/java/de/ids_mannheim/korap/web/utils/MapUtils.java
index df2dfc1..b4d9266 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/utils/MapUtils.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/utils/MapUtils.java
@@ -8,12 +8,18 @@
 
 import javax.ws.rs.core.MultivaluedMap;
 
-/**
+/** Utility methods for maps
+ * 
  * @author margaretha
  *
  */
 public class MapUtils {
 
+    /** Converts {@link MultivaluedMap} to {@link Map}
+     * 
+     * @param multivaluedMap
+     * @return
+     */
     public static Map<String, String> toMap (
             MultivaluedMap<String, String> multivaluedMap) {
         
diff --git a/full/src/test/java/de/ids_mannheim/korap/misc/KoralNodeTest.java b/full/src/test/java/de/ids_mannheim/korap/misc/KoralNodeTest.java
index c0c7012..c4fbbef 100644
--- a/full/src/test/java/de/ids_mannheim/korap/misc/KoralNodeTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/misc/KoralNodeTest.java
@@ -5,7 +5,7 @@
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
-import de.ids_mannheim.korap.resource.rewrite.KoralNode;
+import de.ids_mannheim.korap.rewrite.KoralNode;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
 /**
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/CollectionRewriteTest.java
similarity index 98%
rename from full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
rename to full/src/test/java/de/ids_mannheim/korap/rewrite/CollectionRewriteTest.java
index e055529..630d290 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/CollectionRewriteTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -13,8 +13,10 @@
 import de.ids_mannheim.korap.config.TestVariables;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.rewrite.CollectionCleanRewrite;
 import de.ids_mannheim.korap.rewrite.CollectionConstraint;
 import de.ids_mannheim.korap.rewrite.CollectionRewrite;
+import de.ids_mannheim.korap.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.user.User;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
similarity index 98%
rename from full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
rename to full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
index f159049..dc80bbb 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/FoundryRewriteTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -14,7 +14,8 @@
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.resource.LayerMapper;
+import de.ids_mannheim.korap.rewrite.LayerMapper;
+import de.ids_mannheim.korap.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.user.KorAPUser;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/IdRewriteTest.java
similarity index 92%
rename from full/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
rename to full/src/test/java/de/ids_mannheim/korap/rewrite/IdRewriteTest.java
index ed8f4a3..8f45dc9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/IdRewriteTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -13,6 +13,8 @@
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.rewrite.IdWriter;
+import de.ids_mannheim.korap.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.user.KorAPUser;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/ResultRewriteTest.java
similarity index 91%
rename from full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
rename to full/src/test/java/de/ids_mannheim/korap/rewrite/ResultRewriteTest.java
index 2fe92d8..85691ab 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/ResultRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/ResultRewriteTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import static org.junit.Assert.assertEquals;
 
@@ -9,6 +9,7 @@
 import de.ids_mannheim.korap.config.TestVariables;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.rewrite.CollectionRewrite;
+import de.ids_mannheim.korap.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
 /**
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/RewriteHandlerTest.java
similarity index 93%
rename from full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
rename to full/src/test/java/de/ids_mannheim/korap/rewrite/RewriteHandlerTest.java
index 30ecd1f..9c33f31 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/RewriteHandlerTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -13,6 +13,10 @@
 import de.ids_mannheim.korap.config.SpringJerseyTest;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.rewrite.CollectionCleanRewrite;
+import de.ids_mannheim.korap.rewrite.FoundryInject;
+import de.ids_mannheim.korap.rewrite.IdWriter;
+import de.ids_mannheim.korap.rewrite.RewriteHandler;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
 /** EM: to do: Fix tests
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
similarity index 98%
rename from full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java
rename to full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
index 7702beb..6922522 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/rewrite/VirtualCorpusRewriteTest.java
@@ -1,4 +1,4 @@
-package de.ids_mannheim.korap.resource.rewrite;
+package de.ids_mannheim.korap.rewrite;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
diff --git a/lite/src/main/resources/lite-config.xml b/lite/src/main/resources/lite-config.xml
index 7c5991c..e120e9d 100644
--- a/lite/src/main/resources/lite-config.xml
+++ b/lite/src/main/resources/lite-config.xml
@@ -135,8 +135,8 @@
 	</bean>
 
 	<!-- Filters -->
-	<bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
-		scope="singleton" />
+	<!-- <bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
+		scope="singleton" /> -->
 
 	<!-- Authentication -->
 	<bean id="authenticationManager"
@@ -168,7 +168,7 @@
 	<bean id="annotationConverter" class="de.ids_mannheim.korap.dto.converter.AnnotationConverter" />
 
 	<!-- Rewrite -->
-	<bean id="rewriteHandler" class="de.ids_mannheim.korap.resource.rewrite.RewriteHandler">
+	<bean id="rewriteHandler" class="de.ids_mannheim.korap.rewrite.RewriteHandler">
 		<constructor-arg ref="config" />
 	</bean>
 
diff --git a/lite/src/test/resources/test-config.xml b/lite/src/test/resources/test-config.xml
index 0efa471..434828f 100644
--- a/lite/src/test/resources/test-config.xml
+++ b/lite/src/test/resources/test-config.xml
@@ -122,7 +122,7 @@
 
 	<!-- Initialization -->
 	<bean id="initializator" class="de.ids_mannheim.de.init.LiteInitializatorImpl"
-		init-method="init">
+		init-method="initTest">
 	</bean>
 	<bean id="annotationParser" class="de.ids_mannheim.korap.annotation.AnnotationParser"
 		scope="singleton" />
@@ -133,9 +133,9 @@
 	</bean>
 
 	<!-- Filters -->
-	<bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
+<!-- 	<bean id="APIVersionFilter" class="de.ids_mannheim.korap.web.APIVersionFilter"
 		scope="singleton" />
-
+ -->
 	<!-- Authentication -->
 	<bean id="authenticationManager"
 		class="de.ids_mannheim.korap.authentication.DummyAuthenticationManager" />
@@ -166,7 +166,7 @@
 	<bean id="annotationConverter" class="de.ids_mannheim.korap.dto.converter.AnnotationConverter" />
 
 	<!-- Rewrite -->
-	<bean id="rewriteHandler" class="de.ids_mannheim.korap.resource.rewrite.RewriteHandler">
+	<bean id="rewriteHandler" class="de.ids_mannheim.korap.rewrite.RewriteHandler">
 		<constructor-arg ref="config" />
 	</bean>