Refractored API app into publicapi and ajaxapi