Before filter refactor