andrew jackson , who was elected president in 1828 , and his wife rachel were excoriated as adulterers because they had married in 1791 thinking her divorce from her first husband , lewis robards , was final .