Consolidate the two bloody redundant confusing materialize functions into one