Fixed some errors in my logic for refreshing.