Less garbage (copied from master. untested here).