cleanup of code for repetition of cdf etc; fittest copy