Improved Stack class.