Small refactoring to make code cleaner