Tested and fixed ArrayStack implementation