Refactor AMD implementation