rather strange code with the double assignment but I guess it's fine.