Move some stuff out of API