Refactor Queue and Stack.