improved fetch and prepare data scripts