Separated out the API and removed unnecessary routing