lots of changes to get external data incorporated, now working