Added qFuncation calculation. More work to be done