a bit of Refactoring