refactor before