Fixing error message repeat problem and adding a success message.