Small refactoring to simplify code.