Generic Stack Array implementation