Major API cleanup, working on shutdown