rework amd build (refactor & speed-up)