Optimise apply_slack() for size and speed