diff --git a/db.py b/db.py
index b4b04fc85e49ab8260cb9383ff493e9219922b07..22e09a513c6ef532843e27cf492ab397273a56a1 100644
--- a/db.py
+++ b/db.py
@@ -1,5 +1,4 @@
 from server import *
-import re
 
 if config['DB_ENGINE'] == 'sqlite':
 	import sqlite3
@@ -25,7 +24,6 @@ if config['DB_ENGINE'] == 'sqlite':
 		cur = db.cursor()
 		if config['SQLITE_INIT_SCHEMA']:
 			cur.executescript(open(config['DB_SCHEMA']).read())
-		if config['SQLITE_INIT_DATA'] and created:
 			cur.executescript(open(config['DB_DATA']).read())
 		db.commit()
 		db.close()
@@ -144,31 +142,3 @@ def searchquery(text, columns, match, tables, suffix, *suffixparams):
 		return []
 	expr = 'SELECT *,SUM(_prio) AS _score FROM (%s) AS _tmp %s'%(' UNION '.join(subexprs), suffix)
 	return query(expr, *(list(params)+list(suffixparams)))
-
-LDAP_USERRE = re.compile(r'[^a-z0-9]')
-if 'LDAP_HOST' in config:
-	import ldap3
-
-	def ldapauth(user, password):
-		user = LDAP_USERRE.sub(r'', user.lower())
-		try:
-			conn = ldap3.Connection(ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True), 'fsmpi\\%s'%user, password, auto_bind=True, check_names=False)
-		except ldap3.core.exceptions.LDAPBindError:
-			return {}, []
-		conn.search("cn=users,dc=fsmpi,dc=rwth-aachen,dc=de", "(cn=%s)"%user, attributes=['memberOf', 'givenName', 'sn'])
-		info = {'uid': user, 'givenName': conn.response[0]['attributes']['givenName'][0], 'sn': conn.response[0]['attributes']['sn'][0]}
-		groups = [g.split(',')[0].split('=')[-1] for g in conn.response[0]['attributes']['memberOf']]
-		conn.unbind()
-		return info, groups
-
-else:
-	notldap = {
-		'videoag':('videoag', ['fachschaft','videoag'], {'uid': 'videoag', 'givenName': 'Video', 'sn': 'Geier'}),
-		'gustav':('passwort', ['fachschaft'], {'uid': 'gustav', 'givenName': 'Gustav', 'sn': 'Geier'})
-	}
-
-	def ldapauth(user, password):
-		user = LDAP_USERRE.sub(r'', user.lower())
-		if config.get('DEBUG') and user in notldap and password == notldap[user][0]:
-			return notldap[user][2], notldap[user][1]
-		return {}, []
diff --git a/ldap.py b/ldap.py
new file mode 100644
index 0000000000000000000000000000000000000000..039117695e8c264742b85346db3e2537461da9e8
--- /dev/null
+++ b/ldap.py
@@ -0,0 +1,30 @@
+from server import *
+import re
+
+LDAP_USERRE = re.compile(r'[^a-z0-9]')
+if 'LDAP_HOST' in config:
+	import ldap3
+
+	def ldapauth(user, password):
+		user = LDAP_USERRE.sub(r'', user.lower())
+		try:
+			conn = ldap3.Connection(ldap3.Server(config['LDAP_HOST'], port=config['LDAP_PORT'], use_ssl=True), 'fsmpi\\%s'%user, password, auto_bind=True, check_names=False)
+		except ldap3.core.exceptions.LDAPBindError:
+			return {}, []
+		conn.search("cn=users,dc=fsmpi,dc=rwth-aachen,dc=de", "(cn=%s)"%user, attributes=['memberOf', 'givenName', 'sn'])
+		info = {'uid': user, 'givenName': conn.response[0]['attributes']['givenName'][0], 'sn': conn.response[0]['attributes']['sn'][0]}
+		groups = [g.split(',')[0].split('=')[-1] for g in conn.response[0]['attributes']['memberOf']]
+		conn.unbind()
+		return info, groups
+
+else:
+	notldap = {
+		'videoag':('videoag', ['fachschaft','videoag'], {'uid': 'videoag', 'givenName': 'Video', 'sn': 'Geier'}),
+		'gustav':('passwort', ['fachschaft'], {'uid': 'gustav', 'givenName': 'Gustav', 'sn': 'Geier'})
+	}
+
+	def ldapauth(user, password):
+		user = LDAP_USERRE.sub(r'', user.lower())
+		if config.get('DEBUG') and user in notldap and password == notldap[user][0]:
+			return notldap[user][2], notldap[user][1]
+		return {}, []
diff --git a/server.py b/server.py
index 0f60ae4ec4827f337acb85ce05ebedf66c501dd2..8d2c466741a1ef8d47cfb9cfb5ccf9ff7a15c83c 100644
--- a/server.py
+++ b/server.py
@@ -72,7 +72,8 @@ app.jinja_env.globals['gitversion'] = { 'hash': output[1], 'longhash': output[0]
 if not config.get('SECRET_KEY', None):
 	config['SECRET_KEY'] = os.urandom(24)
 
-from db import query, modify, show, searchquery, ldapauth
+from db import query, modify, show, searchquery
+from ldap import ldapauth
 
 mod_endpoints = []