updated as per @fmichonneau's suggestion