Now with the code from Mikael.