moved api controller out