now deque works better, reverse pointer added