public boolean refreshSMS(final Voice voice) throws IOException {

        System.out.println("Refreshing sms");

        final Collection<SMSThread> smsThreads = voice.getSMSThreads();

		if (smsThreads == null || smsThreads.isEmpty()) {
            System.out.println("No SMSes in thread");
            return false;
        }

        System.out.println("Got " + smsThreads.size() + " SMSes");

        // Convert to array so we can access SMS in reverse, i.e., oldest first
		final SMSThread[] smsThreadArr = smsThreads.toArray(new SMSThread[smsThreads.size()]);

		//System.out.println("-----------------------");
		
		for (int i = smsThreadArr.length - 1; i >= 0; i--) {
			
			SMSThread smsThread = smsThreadArr[i];
			Collection<SMS> smsList = smsThread.getAllSMS();
			
			SMS[] smsArr = smsList.toArray(new SMS[smsList.size()]);
			
			for (int j = smsArr.length - 1; j >= 0; j--) {
				SMS sms = smsArr[j];
				
				// Ignore from "Me" messages
				if (sms.getFrom().getName().equals("Me"))
					continue;
				
				Pledge p = new Pledge(sms.getContent(), sms.getFrom().getName());
				
				if (!pledgeSet.contains(p)) {
					pledgeSet.add(p);
					pledgeControl.addPledge(p);
					
					if (shouldSendReply &&
						replyMessage != null && 
						refreshCounter != 0) {
						System.out.println("sending reply to " + sms.getFrom().getNumber());
						
                        voice.sendSMS(sms.getFrom().getNumber(),
                                      replyMessage);
                    }
				}
			}
		}
		refreshCounter++;
		
		return true;
	}