Updated patch with Patryk's feedback