improve way for calculating coeficients. Work in progress"