Working api and tests