@Override
	public void run() {

		// The number of documents that has been found
		long count = 0;

		try {
			// Keep running until we are interrupted
			while (isInterrupted() == false) {

				// Check to see if there is a user checked in and tweeting is
				// enabled
				if ((myUserLoggedIn == true) && (isTweetingEnabled())) {

					try {
						String item = myQueue.poll(POLLING_FREQUENCY,
								TimeUnit.MILLISECONDS);

						// Check to see if there is something to process
						if (item != null) {
							
							// If this is this is the first item then create the gist
							if (count == 0) {
								// Create the Gist document
								createGist();
							}

							// Add the entry to the gist document no matter what
							updateGistFile(count, item);

							// Tweet status
							Status status;

							// Check to see if the tweet is too long
							if (item.length() > MAX_TWEET_LENGTH) {

								// Build the tweet (this will be about 104
								// characters total)
								StringBuilder tweet = new StringBuilder();
								tweet.append("Too large to tweet.  See Document #");
								tweet.append(Long.toString(count));
								tweet.append(" in the Gist file here: ");
								tweet.append(myGist.getHtmlUrl());

								// tweet the status update
								status = myTwitter.updateStatus(tweet
										.toString());

							} else {
								// Tweet the status update
								status = myTwitter.updateStatus(item);
							}

							// Increment document count
							count++;

							// Build the resulting URL and put it in the
							// data model being shown in the GUI
							String tweetUrl = buildTweetUrl(status.getUser()
									.getScreenName(), status.getId());

							// Append the tweet the document model
							myModel.insertString(myModel.getLength(), tweetUrl
									+ "\n", null);

							// Sleep for a rule specified duration to keep
							// tweets from being too frequent
							sleep(myTwitterRules.getTweetFrequency());
						}
					} catch (TwitterException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					} catch (BadLocationException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
				} else {
					// Nothing going on, lets sleep for a bit
					sleep(POLLING_FREQUENCY);
				}
			}
		} catch (InterruptedException e) {
			// This thread has been stopped
		}
	}