a bit more progress. I really need to speed this up.