clean up RGAPI internals and interface (uses delegates for some stuff)