finish case refactor