Improve api callbacks