Small refactoring to save memory