Modify stack implementation to use vector instead of internal array