Separate API and main.