got it working with callbacks