functioning and slow code with actual data points