Merged Jens's changes