updated to use better version of chains