Fix structures related to api
Rewrite all funcs - fixed all