Refactoring guard to its own class