controllers for api rewritten