Revert "Refactor refiling code"