implemented code for working api