Stack implementation from JS Allongé