Made stack allocation variable/optional.