Fork : Adapt code based on Georgius comment :)