Added deque into background
added deque into index
changed deque api
integrated deque with index and background