made most of Bernhards changes, plus changed to only work out first coefficient