Preserve the original order by avoiding the intermediate map[string] and keeping an index for the first occurrence of a stack; this also avoids looping multiple times. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>