made api namespaces, moved api controller methods into api controllers