Going back to functions for sample_states & logistic_function