first implementation of StackArray