[api] rework the biggest functions a bit more