Update with latest changes from opdenkamp's master