I checked This stackoverflow post, but I still cannot understand.
I have this code (yes I know achieves the same thing) which worked