diff --git a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/AliasManager.kt b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/AliasManager.kt
index e834c8e36d93e066825338afb760c81abeb63df1..5d1a24e707cb5c3178f3e674f06513d9b54ae7ec 100644
--- a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/AliasManager.kt
+++ b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/syncables/AliasManager.kt
@@ -16,9 +16,11 @@ import de.justjanne.libquassel.protocol.models.Command
 import de.justjanne.libquassel.protocol.models.QStringList
 import de.justjanne.libquassel.protocol.models.types.QtType
 import de.justjanne.libquassel.protocol.syncables.stubs.AliasManagerStub
+import de.justjanne.libquassel.protocol.util.expansion.Expansion
 import de.justjanne.libquassel.protocol.variant.QVariantMap
 import de.justjanne.libquassel.protocol.variant.into
 import de.justjanne.libquassel.protocol.variant.qVariant
+import kotlin.math.exp
 
 class AliasManager constructor(
   session: Session
@@ -90,9 +92,28 @@ class AliasManager constructor(
   fun expand(
     expansion: String,
     bufferInfo: BufferInfo,
-    msg: String,
+    arguments: String,
     previousCommands: MutableList<Command>
   ) {
+    /*
+    val params = arguments.split(' ')
+    expansion.split(';')
+      .map(String::trimStart)
+      .map(Expansion.Companion::parse)
+      .map {
+        it.map {
+          when (it) {
+            is Expansion.Constant -> TODO()
+            is Expansion.Parameter -> TODO()
+            is Expansion.ParameterRange ->
+              params.subList(it.from, it.to ?: params.size)
+                .joinToString(" ")
+            is Expansion.Text ->
+              it.value
+          }
+        }
+      }
+    */
   }
 
   fun copy() = AliasManager(session).also {
diff --git a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/util/expansion/Expansion.kt b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/util/expansion/Expansion.kt
index 93da3d9035c2afa957823ee5f8a09dbb65974474..a694729e42f83d5f338ef1f9f29b29aed72a77fc 100644
--- a/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/util/expansion/Expansion.kt
+++ b/libquassel-protocol/src/main/kotlin/de/justjanne/libquassel/protocol/util/expansion/Expansion.kt
@@ -10,26 +10,126 @@
 
 package de.justjanne.libquassel.protocol.util.expansion
 
+/**
+ * Model for a command expansion
+ */
 sealed class Expansion {
-  data class Text(val value: String) : Expansion()
-  data class ParameterRange(val from: Int, val to: Int?) : Expansion()
-  data class Parameter(val index: Int, val field: ParameterField?) : Expansion()
-  data class Constant(val field: ConstantField) : Expansion()
+  /**
+   * Model for raw text
+   */
+  data class Text(
+    /**
+     * Text to insert
+     */
+    val value: String
+  ) : Expansion()
+
+  /**
+   * Model for a parameter range
+   */
+  data class ParameterRange(
+    /**
+     * Index of the first included parameter.
+     */
+    val from: Int,
+    /**
+     * Index of the last included parameter.
+     * If null, this means all parameters after the start should be included
+     */
+    val to: Int?
+  ) : Expansion()
+
+  /**
+   * Model for a single parameter
+   */
+  data class Parameter(
+    /**
+     * Index of the parameter
+     */
+    val index: Int,
+    /**
+     * Attribute of the parameter to access, if possible.
+     *
+     * If null, this just inserts the value of the nth parameter itself.
+     * Otherwise this causes a lookup of the specified value.
+     *
+     * If e.g. the nth value is "justjanne", and this field is set to
+     * [ParameterField.VERIFIED_IDENT], it’ll look up the ident of justjanne
+     * in the current context, try to verify it, and set it to * otherwise.
+     */
+    val field: ParameterField?
+  ) : Expansion()
 
+  /**
+   * Model for a single constant in the current context
+   */
+  data class Constant(
+    /**
+     * Type of constant to be inserted
+     */
+    val field: ConstantField
+  ) : Expansion()
+
+  /**
+   * Potential fields that can be specified on a given parameter
+   */
   enum class ParameterField {
+    /**
+     * Hostname of the ircuser with the specified nick on the network of the
+     * given context, or "*" if the user is not found or the hostname could not
+     * be determined.
+     */
     HOSTNAME,
+
+    /**
+     * Ident of the ircuser with the specified nick on the network of the
+     * given context.
+     *
+     * Will be set to "*" if the ident is not verified (prefixed with ~), the
+     * user is not found or the ident could not be determined.
+     */
     VERIFIED_IDENT,
+
+    /**
+     * Ident of the ircuser with the specified nick on the network of the
+     * given context, or "*" if the user is not found or the hostname could not
+     * be determined.
+     */
     IDENT,
+
+    /**
+     * Account of the ircuser with the specified nick on the network of the
+     * given context, or "*" if the user is not found or the hostname could not
+     * be determined.
+     */
     ACCOUNT
   }
 
+  /**
+   * Potential fields that can be specified on a given context
+   */
   enum class ConstantField {
+    /**
+     * Name of the current IRC channel, otherwise the name of the current chat
+     * if the alias is invoked outside of a channel
+     */
     CHANNEL,
+
+    /**
+     * Nick of the user invoking this alias
+     */
     NICK,
+
+    /**
+     * Name of the network this alias is invoked on
+     */
     NETWORK
   }
 
   companion object {
+    /**
+     * Parse a list of expansions from a given expansion string
+     */
     fun parse(text: String): List<Expansion> =
       ExpansionParsingContext(text).parse()
   }