refactored code for mailchimp api