Implementation of stack/queue data structure.