Add coefficients calculations. Refactor tests.