changed retriving of each message from GMail to retrieving of all messages in all threads at once using function getMessagesForThreads(), now there is no time exceeding problems