working (but not finished) version with callbacks