refactor linear_coefficients
proceed if c1 or c2 is not zero
Added helper functions, new tests