refactoring before block