Made the globals match the R_* standard.  Also tried to clean up naming stuff.