I added another pull request that implements all of the mentioned stuff and also improves callback handling.