Adding ab and coeff calcs, some bugfixes