#18 A bit of refactoring