added tests and API controller