A better version of pull #144