Deque and history update
Made app ids dynamic
Extra logging