Implement stack data structure.