r versions added. minor style modifications