refactor AMD