Clean up code and put transformation on (build_vec (ext x)) into a helper func