basic refactoring of logreg package