Refactor based on review feedback