Commented and cleaned up AI.

Signed-off-by: Christian Gunderman <gundermanc@gmail.com>