Implementation of stack data structure.