Improving patch with recommendations given by Joakim Plate