add onSuccess and onError callbacks