edited for callback