Consumer confidence helps drive stock market gains