Add core api
Refactor some routes