Implements PR suggestions for #1524

@tilgovi take them if they suit.