Some light refactoring