Working correctly with callbacks