allow user to specify hyperparameters; some cleanup; roxygenize