changed functions with new arrays