initial version working with fitted polynomials rather than arrays