implements queue data structure and refactoring stack.go