Changed the data structure of Service.inputStack from list to collections.deque.