furthur modularized the code
got the initial log likelihood computed