Small refactor suggested by Matthias.