added diagram export logic