Miscelaneous runtime detection code cleanup, re-org of API