Start of integrating Hugo Krawczyk's suggestion