finished refactoring amazon