new diagram function added