More API and some cleanup