fixed primary coefficient calculations. boundary to be tested.