rrdf code from http://goo.gl/OwjblF