Added gmail api helper and process state completion "heuristic"