 				return
 			try
 				auth = JSON.parse contents
+				
+				# convert into functions
 				if auth.packages?
-					for _package, versions of auth.packages
-						auth.packages[_package] = createComparator versions
+					auth.packages[_package] = createComparator versions for _package, versions of auth.packages
 				if auth.groups?
 					for group, packages of auth.groups
-						for _package, versions of packages
-							auth.groups[group][_package] = createComparator versions
+						auth.groups[group][_package] = createComparator versions for _package, versions of packages
 				if auth.users?
 					for user of auth.users
-						for _package, versions of auth.users[user].packages
-							auth.users[user].packages[_package] = createComparator versions
+						auth.users[user].packages[_package] = createComparator versions for _package, versions of auth.users[user].packages
 				logger.log "notice", "Updated auth"
 			catch err
 				logger.log "error", "error reading auth.json. Denying access to all packages: #{err}"

				writer.startElement 'version'
				writer.writeAttribute 'name', versionNumber
				
				# we do not support authentification
				writer.writeAttribute 'accessible', if (isAccessible username, _package.name, versionNumber) then "true" else "false" # TODO: Use proper username
				writer.writeAttribute 'isCritical', if (/pl/i.test versionNumber) then "true" else "false"
				if version.fromversions.length
					writer.startElement 'fromversions'
					for fromVersion in version.fromversions
						writer.writeElement 'fromversion', fromVersion
					do writer.endElement
				if version.requiredpackages.requiredpackage.length
					writer.startElement 'requiredpackages'
					for requiredPackage in version.requiredpackages.requiredpackage
						writer.startElement 'requiredpackage'
						writer.writeAttribute 'minversion', requiredPackage.$.minversion if requiredPackage.$.minversion?
						writer.text requiredPackage._
						do writer.endElement
					do writer.endElement
				writer.writeElement 'timestamp', String(Math.floor (do version.timestamp.getTime) / 1000)
				
				# e.g. {{packageServerHost}}/com.example.wcf.test/1.0.0_Alpha_15

					writer.writeAttribute 'url', result[2] if result[2]?
					writer.text result[1]
					do writer.endElement
					
				do writer.endElement
			do writer.endElement
			do writer.endElement
