(cherry picked from commit b5f36092)
Co-authored-by: Marcin Kirsz marcin.kirsz@ed.ac.uk
(cherry picked from commit 4a783eb6)