added optional flatten_results parameter to flatten "lists of lists"