some modifs + new construct_beta routine, was tested