Adding Istvan's changes as add-on branch.