refactor build_stacks()

3 jobs for !143 with implement-mm-coatings in 1 minute and 35 seconds
latest merge request