Split into library and runtime