restructure and remove deprecated fill_array function