refactor to cumulative distribution