move data handling code into its own directory