UPD: adapted after comment