working graph function added 06/05/13 - TC