train to cdf changes
cleaned up the code