Converted histogram_path_demo to function