renamed k->beta and k_pos->k to have the same indices as the thesis
merged index renaming from master