Small refactoring of code