Moved api to its own controller, adapted routes