Refactorisation. Fixes #1