Putting callback into the constructor