added r500 functionality. Not tested yet