 # Layout helpers
 
 detectHeaderFooter = (layer) ->
+
+	# This function tries to detect a stack of:
+	# 1) header / body / footer
+	# 2) header / body
+	# 3) body / footer
+
+	# A valid layout is when:
+	# - The child layers cover the entire parent edge to edge.
+	# - The child layers are vertically stacked, edge to edge.
 
 	result =
 		header: null

			return unless layer instanceof Layer
			@_footer = layer
			@_footer.name = "footer"
			@_footer.setParentPreservingConstraintValues(@)
			if not @_footer.constraintValues?
				@_footer.x = Align.center

		wrappedLayer.parent = @
		wrappedLayer.visible = not options.animate

		layerA = @current
		layerB = wrappedLayer
		overlay = @overlay

