A little bit of code refactoring