Rework function prepare_toolchains